Class: Iugu::Account
- Inherits:
-
APIResource
- Object
- Object
- APIResource
- Iugu::Account
- Defined in:
- lib/iugu/account.rb
Instance Attribute Summary
Attributes inherited from Object
#attributes, #errors, #unsaved_attributes
Class Method Summary collapse
-
.bank(attributes, user_token) ⇒ Object
POST /bank_verification.
-
.banks(user_token) ⇒ Object
GET /bank_verification.
-
.configuration(attributes, api_token) ⇒ Object
Configures a account POST /accounts/configuration.
-
.create(attributes) ⇒ Object
POST /marketplace/create_account.
-
.fetch(account_id, user_token) ⇒ Object
GET /accounts/:account_id.
-
.transfer(attributes, api_token) ⇒ Object
POST /accounts/transfers.
-
.verify(attributes, account_id, user_token) ⇒ Object
POST /accounts/:account_id/request_verification.
-
.withdraw(attributes, account_id, user_token) ⇒ Object
POST /accounts/:account_id/request_withdraw.
Methods inherited from APIResource
endpoint_url, #is_new?, object_base_uri, object_type, relative_url, url
Methods inherited from Object
#add_accessor, #copy, #initialize, #method_missing, #modified_attributes, #set_attributes
Constructor Details
This class inherits a constructor from Iugu::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Iugu::Object
Class Method Details
.bank(attributes, user_token) ⇒ Object
POST /bank_verification
Update a bank account
177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/iugu/account.rb', line 177 def self.bank(attributes, user_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{Iugu.base_uri}bank_verification", attributes, user_token ) ) end |
.banks(user_token) ⇒ Object
GET /bank_verification
List bank accounts
195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/iugu/account.rb', line 195 def self.banks(user_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "GET", "#{Iugu.base_uri}bank_verification", {}, user_token ) ) end |
.configuration(attributes, api_token) ⇒ Object
Configures a account POST /accounts/configuration
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/iugu/account.rb', line 110 def self.configuration(attributes, api_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{url}/configuration", attributes, api_token ) ) end |
.create(attributes) ⇒ Object
POST /marketplace/create_account
Creates a account
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/iugu/account.rb', line 14 def self.create(attributes) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{Iugu.base_uri}marketplace/create_account", attributes ) ) end |
.fetch(account_id, user_token) ⇒ Object
GET /accounts/:account_id
Searchs a account
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/iugu/account.rb', line 95 def self.fetch(account_id, user_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "GET", "#{url(account_id)}", {}, user_token ) ) end |
.transfer(attributes, api_token) ⇒ Object
POST /accounts/transfers
Transfers an amount to another account
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/iugu/account.rb', line 131 def self.transfer(attributes, api_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{Iugu.base_uri}transfers", attributes, api_token ) ) end |
.verify(attributes, account_id, user_token) ⇒ Object
POST /accounts/:account_id/request_verification
Verify a account
'Mais que R$ 500,00']
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/iugu/account.rb', line 76 def self.verify(attributes, account_id, user_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{url(account_id)}/request_verification", attributes, user_token ) ) end |
.withdraw(attributes, account_id, user_token) ⇒ Object
POST /accounts/:account_id/request_withdraw
Withdraw a value of an account
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/iugu/account.rb', line 153 def self.withdraw(attributes, account_id, user_token) Iugu::Factory.create_from_response( object_type, APIRequest.request( "POST", "#{url(account_id)}/request_withdraw", attributes, user_token ) ) end |