Class: Asaas::Api::Base
- Inherits:
-
Object
- Object
- Asaas::Api::Base
- Defined in:
- lib/asaas/api/base.rb
Direct Known Subclasses
Account, City, Customer, Document, Notification, Payment, Subscription, Transfer, Webhook
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#route ⇒ Object
Returns the value of attribute route.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #create(attrs) ⇒ Object
- #delete(id) ⇒ Object
- #extract_meta(meta) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(client_token, api_version, route = nil) ⇒ Base
constructor
A new instance of Base.
- #list(params = {}) ⇒ Object
- #update(attrs) ⇒ Object
Constructor Details
#initialize(client_token, api_version, route = nil) ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 17 |
# File 'lib/asaas/api/base.rb', line 12 def initialize(client_token, api_version, route = nil) @token = client_token @route = route @api_version = api_version || Asaas::Configuration.api_version @endpoint = Asaas::Configuration.get_endpoint(api_version) end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/asaas/api/base.rb', line 5 def endpoint @endpoint end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/asaas/api/base.rb', line 7 def errors @errors end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
6 7 8 |
# File 'lib/asaas/api/base.rb', line 6 def @meta end |
#route ⇒ Object
Returns the value of attribute route.
10 11 12 |
# File 'lib/asaas/api/base.rb', line 10 def route @route end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
8 9 10 |
# File 'lib/asaas/api/base.rb', line 8 def success @success end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
9 10 11 |
# File 'lib/asaas/api/base.rb', line 9 def token @token end |
Instance Method Details
#create(attrs) ⇒ Object
33 34 35 36 |
# File 'lib/asaas/api/base.rb', line 33 def create(attrs) request(:post, {}, attrs) parse_response end |
#delete(id) ⇒ Object
43 44 45 46 |
# File 'lib/asaas/api/base.rb', line 43 def delete(id) request(:delete, {id: id}) parse_response end |
#extract_meta(meta) ⇒ Object
19 20 21 |
# File 'lib/asaas/api/base.rb', line 19 def () @meta = Asaas::Entity::Meta.new() end |
#get(id) ⇒ Object
23 24 25 26 |
# File 'lib/asaas/api/base.rb', line 23 def get(id) request(:get, {id: id}) parse_response end |
#list(params = {}) ⇒ Object
28 29 30 31 |
# File 'lib/asaas/api/base.rb', line 28 def list(params = {}) request(:get, params) parse_response end |
#update(attrs) ⇒ Object
38 39 40 41 |
# File 'lib/asaas/api/base.rb', line 38 def update(attrs) request(:post, {id: attrs.id}, attrs) parse_response end |