Class: Billimatic::Client
- Inherits:
-
Object
- Object
- Billimatic::Client
- Defined in:
- lib/billimatic/client.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #companies ⇒ Object
- #contracts ⇒ Object
- #email_templates ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #invoice_rules ⇒ Object
- #invoice_templates ⇒ Object
- #invoices ⇒ Object
- #organizations ⇒ Object
- #people ⇒ Object
- #plans ⇒ Object
- #service_items ⇒ Object
- #subscriptions ⇒ Object
- #webhooks ⇒ Object
Constructor Details
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
3 4 5 |
# File 'lib/billimatic/client.rb', line 3 def http @http end |
Instance Method Details
#authenticated? ⇒ Boolean
9 10 11 12 13 14 15 16 |
# File 'lib/billimatic/client.rb', line 9 def authenticated? http.get("/companies/search?cnpj=auth_test") do |response| response.code == 200 end rescue RequestError => e raise e unless e.code == 401 false end |
#companies ⇒ Object
46 47 48 |
# File 'lib/billimatic/client.rb', line 46 def companies Resources::Company.new(http) end |
#contracts ⇒ Object
30 31 32 |
# File 'lib/billimatic/client.rb', line 30 def contracts Resources::Contract.new(http) end |
#email_templates ⇒ Object
62 63 64 |
# File 'lib/billimatic/client.rb', line 62 def email_templates Resources::EmailTemplate.new(http) end |
#invoice_rules ⇒ Object
42 43 44 |
# File 'lib/billimatic/client.rb', line 42 def invoice_rules Resources::InvoiceRule.new(http) end |
#invoice_templates ⇒ Object
38 39 40 |
# File 'lib/billimatic/client.rb', line 38 def invoice_templates Resources::InvoiceTemplate.new(http) end |
#invoices ⇒ Object
34 35 36 |
# File 'lib/billimatic/client.rb', line 34 def invoices Resources::Invoice.new(http) end |
#organizations ⇒ Object
18 19 20 |
# File 'lib/billimatic/client.rb', line 18 def organizations Resources::Organization.new(http) end |
#people ⇒ Object
50 51 52 |
# File 'lib/billimatic/client.rb', line 50 def people Resources::Person.new(http) end |
#plans ⇒ Object
22 23 24 |
# File 'lib/billimatic/client.rb', line 22 def plans Resources::Plan.new(http) end |
#service_items ⇒ Object
54 55 56 |
# File 'lib/billimatic/client.rb', line 54 def service_items Resources::ServiceItem.new(http) end |
#subscriptions ⇒ Object
26 27 28 |
# File 'lib/billimatic/client.rb', line 26 def subscriptions Resources::Subscription.new(http) end |