Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass all method parameters in constructor #56

Merged
merged 2 commits into from
Nov 6, 2014
Merged

Pass all method parameters in constructor #56

merged 2 commits into from
Nov 6, 2014

Conversation

tarmolov
Copy link
Member

@tarmolov tarmolov commented Nov 5, 2014

Implementation of the interface:

var myMethod = new ApiMethod({
    name: 'myMethod',
    params: {
        name: {type: 'String', required: true}
    },
    options: {
        hiddenOnDocPage: true
    },
    action: function (params) {
        // ...
    }
});

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling eccd71c on method into 0b5678a on master.

@dodev
Copy link
Contributor

dodev commented Nov 6, 2014

So we're dropping support for the old declaration style? I don't think that's a good idea. Maybe we can support both? I know it's version 0.x, but that seems too radical.

this._options = {};
__constructor: function (method) {
if (!method || !method.name || !method.action) {
throw new ApiError(ApiError.INTERNAL_ERROR, 'Method name and method action are unspecified');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the error should be something like 'Some of the required method properties were not specified (name, action).'

@tarmolov
Copy link
Member Author

tarmolov commented Nov 6, 2014

Firstly, I kept the old version but then pruned it.

Services should rewrite their code anyway. Renaming changes was radical, too.

Ok, I'll revert removing old methods, mark them as @deprecated, and keep them in the ApiMethod class. @lemmy- voted for keeping old methods, too.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.56%) when pulling 800d94a on method into 0b5678a on master.

@tarmolov tarmolov force-pushed the method branch 2 times, most recently from ac0db65 to 5b09986 Compare November 6, 2014 16:15
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 5b09986 on method into 0b5678a on master.

@tarmolov
Copy link
Member Author

tarmolov commented Nov 6, 2014

pr with updated normalize function waits for merging this pr. Please take a look, guys.

.setAction(function (params, request, api) {
methods: {
type: 'Array',
description: 'Set of methods with a data',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... with data ... or with params

@watch-the-stars
Copy link

LGTM

Upd: though, I'm not a guy ;)

@tarmolov
Copy link
Member Author

tarmolov commented Nov 6, 2014

(guys) амер. ; разг. ребята, люди (используется при обращении к лицам мужского и женского пола)

http://www.lingvo-online.ru/en/Translate/en-ru/guy

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 1142812 on method into 0b5678a on master.

@tarmolov
Copy link
Member Author

tarmolov commented Nov 6, 2014

I did what @dodev suggested. So, let's say that 1 LGTM is sufficient for this pr ;)

tarmolov added a commit that referenced this pull request Nov 6, 2014
Pass all method parameters in constructor
@tarmolov tarmolov merged commit da0abce into master Nov 6, 2014
@tarmolov tarmolov deleted the method branch November 6, 2014 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants