Class: Omie::Client
- Inherits:
-
Object
- Object
- Omie::Client
- Defined in:
- lib/omie/client.rb
Constant Summary collapse
- BASE_URL =
"https://app.omie.com.br/api/v1"
Instance Attribute Summary collapse
-
#app_key ⇒ Object
readonly
Returns the value of attribute app_key.
-
#app_secret ⇒ Object
readonly
Returns the value of attribute app_secret.
Instance Method Summary collapse
- #customer ⇒ Object
-
#initialize(app_key: nil, app_secret: nil) ⇒ Client
constructor
A new instance of Client.
- #service_invoice ⇒ Object
- #service_order ⇒ Object
Constructor Details
#initialize(app_key: nil, app_secret: nil) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/omie/client.rb', line 13 def initialize(app_key: nil, app_secret: nil) @app_key = app_key || ENV.fetch("OMIE_APP_KEY") @app_secret = app_secret || ENV.fetch("OMIE_APP_SECRET") @conn = Faraday.new(BASE_URL) do |conn| conn.request :omie_authentication, app_key: @app_key, app_secret: @app_secret conn.request :json conn.response :json end end |
Instance Attribute Details
#app_key ⇒ Object (readonly)
Returns the value of attribute app_key.
11 12 13 |
# File 'lib/omie/client.rb', line 11 def app_key @app_key end |
#app_secret ⇒ Object (readonly)
Returns the value of attribute app_secret.
11 12 13 |
# File 'lib/omie/client.rb', line 11 def app_secret @app_secret end |
Instance Method Details
#customer ⇒ Object
25 26 27 |
# File 'lib/omie/client.rb', line 25 def customer @customer ||= API::Customer.new(conn) end |
#service_invoice ⇒ Object
33 34 35 |
# File 'lib/omie/client.rb', line 33 def service_invoice @service_invoice ||= API::ServiceInvoice.new(conn) end |
#service_order ⇒ Object
29 30 31 |
# File 'lib/omie/client.rb', line 29 def service_order @service_order ||= API::ServiceOrder.new(conn) end |