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

Add costs to client #12

Merged
merged 6 commits into from
Jul 20, 2015
Merged

Add costs to client #12

merged 6 commits into from
Jul 20, 2015

Conversation

emachnic
Copy link
Contributor

This exposes costs from the API for an account. Given an account, you should be able to get the array of costs for that account.

Example:

costs = account.costs.all

If you have the costs array, you should then be able to select any costs that fit your needs:

costs.select { |c| c.level == 'final' }

@jacobo
Copy link
Contributor

jacobo commented Jul 20, 2015

LGTM, although note: you could just request the costs where level: 'total' instead of requesting all and then selecting the 'total' ones

def get_costs(params={})
request(
"url" => params["url"],
"path" => "/accounts/#{params[:id]}/costs"
Copy link
Contributor

Choose a reason for hiding this comment

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

params["id"]

jacobo added a commit that referenced this pull request Jul 20, 2015
@jacobo jacobo merged commit 8c50ef5 into master Jul 20, 2015
@jacobo jacobo deleted the costs branch July 20, 2015 23:29
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.

3 participants