-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Account API endpoint [ch28502] (#101)
* updated ruby library to include the account api endpoint * adjusted testing to use vcr cassette * set vcr to output one single cassette
- Loading branch information
1 parent
b585cc8
commit becc95b
Showing
5 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
fixtures/vcr_cassettes/ChartMogul_Account/returns_details_of_current_account.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module ChartMogul | ||
class Account < APIResource | ||
set_resource_name 'Account' | ||
set_resource_path '/v1/account' | ||
|
||
readonly_attr :name | ||
readonly_attr :currency | ||
readonly_attr :time_zone | ||
readonly_attr :week_start_on | ||
|
||
include API::Actions::Custom | ||
|
||
def self.retrieve | ||
custom!(:get, '/v1/account') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ChartMogul | ||
VERSION = '1.6.9' | ||
VERSION = '1.7.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe ChartMogul::Account, uses_api: true do | ||
describe 'API interactions' do | ||
around(:all) do |example| | ||
VCR.use_cassette('ChartMogul_Account/returns_details_of_current_account', &example) | ||
end | ||
|
||
let(:account) { ChartMogul::Account.retrieve } | ||
|
||
it 'returns the name of current account', uses_api: true do | ||
expect(account.name).to eq('Example Test Company') | ||
end | ||
|
||
it 'returns the currency of current account', uses_api: true do | ||
expect(account.currency).to eq('EUR') | ||
end | ||
|
||
it 'returns the time zone of current account', uses_api: true do | ||
expect(account.time_zone).to eq('Europe/Berlin') | ||
end | ||
|
||
it 'returns the week_start_on of current account', uses_api: true do | ||
expect(account.week_start_on).to eq('sunday') | ||
end | ||
end | ||
end |