Class: Moip2::AccountsApi
- Inherits:
-
Object
- Object
- Moip2::AccountsApi
- Defined in:
- lib/moip2/accounts_api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #base_path ⇒ Object
- #create(account) ⇒ Object
- #exists?(tax_document) ⇒ Boolean
-
#initialize(client) ⇒ AccountsApi
constructor
A new instance of AccountsApi.
- #show(id) ⇒ Object
Constructor Details
#initialize(client) ⇒ AccountsApi
Returns a new instance of AccountsApi.
5 6 7 |
# File 'lib/moip2/accounts_api.rb', line 5 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/moip2/accounts_api.rb', line 3 def client @client end |
Instance Method Details
#base_path ⇒ Object
9 10 11 |
# File 'lib/moip2/accounts_api.rb', line 9 def base_path "/v2/accounts" end |
#create(account) ⇒ Object
13 14 15 |
# File 'lib/moip2/accounts_api.rb', line 13 def create(account) Resource::Account.new client, client.post(base_path, account) end |
#exists?(tax_document) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/moip2/accounts_api.rb', line 17 def exists?(tax_document) response = client.get("#{base_path}/exists?tax_document=#{tax_document}") response.success? end |