Skip to content

Add rate limit endpoint #314

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

Merged
merged 9 commits into from
Oct 11, 2015

Conversation

quickliketurtle
Copy link
Contributor

Hello,
I've added the rate_limit endpoint. With the default response, as well as 2 helpers for core rate limit and search rate limit.

I updated Client.php to allow both rateLimit and rate_limit options.

I've added a Test with the sample rate_limit response from github, as well as a functional test ( the functional group is excluded now, but you can run the single file manually and it passes ).

Also added a doc page.

Let me know if there are changed needed. I tried to follow style and naming convention by looking at existing code.

Thanks.

/**
* Get rate limits
*
* @return \Guzzle\Http\EntityBodyInterface|mixed|string
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks weird. The other methods tell me that this returns an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, phpstrom thought for me on that one, will update to array.

@quickliketurtle
Copy link
Contributor Author

Sorry for all the style fix commits... kept missing extra lines.

@soullivaneuh
Copy link
Contributor

👍

@stof
Copy link
Contributor

stof commented Oct 7, 2015

your new doc page needs to be linked from other doc page (probably the doc index in this case)

@quickliketurtle
Copy link
Contributor Author

@stof Good catch, i added the link to the readme.

public function getCoreLimit()
{
$response = $this->getRateLimits();
return $response['resources']['core']['limit'];
Copy link
Contributor

Choose a reason for hiding this comment

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

please separate return statement with 1 blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

@cursedcoder

You should use symfony preset on your StyleCI config file or at least, add the return fixer.

Copy link
Contributor

Choose a reason for hiding this comment

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

See #323.

cursedcoder added a commit that referenced this pull request Oct 11, 2015
@cursedcoder cursedcoder merged commit 832b7be into KnpLabs:master Oct 11, 2015
@cursedcoder
Copy link
Contributor

@quickliketurtle very good, thank you!

@quickliketurtle quickliketurtle deleted the add-rate-limit-endpoint branch October 12, 2015 15:23
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