Class: Cobrato::Client
- Inherits:
-
Object
- Object
- Cobrato::Client
- Defined in:
- lib/cobrato/client.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #bank_accounts ⇒ Object
- #charge_accounts ⇒ Object
- #charges ⇒ Object
- #charging_types ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #payees ⇒ Object
- #webhooks ⇒ Object
Constructor Details
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
3 4 5 |
# File 'lib/cobrato/client.rb', line 3 def http @http end |
Instance Method Details
#authenticated? ⇒ Boolean
9 10 11 12 13 14 15 16 |
# File 'lib/cobrato/client.rb', line 9 def authenticated? http.get("") do |response| response.code == 200 end rescue RequestError => e raise e unless e.code == 401 false end |
#bank_accounts ⇒ Object
22 23 24 |
# File 'lib/cobrato/client.rb', line 22 def bank_accounts Resources::BankAccount.new(http) end |
#charge_accounts ⇒ Object
26 27 28 |
# File 'lib/cobrato/client.rb', line 26 def charge_accounts Resources::ChargeAccount.new(http) end |
#charges ⇒ Object
30 31 32 |
# File 'lib/cobrato/client.rb', line 30 def charges Resources::Charge.new(http) end |
#charging_types ⇒ Object
38 39 40 |
# File 'lib/cobrato/client.rb', line 38 def charging_types Resources::ChargingType.new(http) end |