Class: Exact::Client
- Inherits:
-
Object
- Object
- Exact::Client
- Defined in:
- lib/exact/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#division ⇒ Object
Returns the value of attribute division.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#exact_client ⇒ Object
readonly
Returns the value of attribute exact_client.
-
#exact_url ⇒ Object
readonly
Returns the value of attribute exact_url.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(access_token:, division:, service:, endpoint:) ⇒ Client
constructor
A new instance of Client.
- #method_missing(mthd, *args, &block) ⇒ Object
Constructor Details
#initialize(access_token:, division:, service:, endpoint:) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 |
# File 'lib/exact/client.rb', line 8 def initialize(access_token:, division:, service:, endpoint:) @access_token = access_token @division = division @service = service @endpoint = endpoint @exact_url = "#{Exact.configuration.exact_url}/#{division}/#{service}" @exact_client = OData::Service.new(@exact_url, access_token: access_token, namespace: 'Exactonline') @exact_client.send(endpoint) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mthd, *args, &block) ⇒ Object
18 19 20 |
# File 'lib/exact/client.rb', line 18 def method_missing(mthd, *args, &block) exact_client.send(mthd, *args, &block) if exact_client.respond_to? mthd.to_s end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/exact/client.rb', line 6 def access_token @access_token end |
#division ⇒ Object
Returns the value of attribute division.
6 7 8 |
# File 'lib/exact/client.rb', line 6 def division @division end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/exact/client.rb', line 6 def endpoint @endpoint end |
#exact_client ⇒ Object (readonly)
Returns the value of attribute exact_client.
5 6 7 |
# File 'lib/exact/client.rb', line 5 def exact_client @exact_client end |
#exact_url ⇒ Object (readonly)
Returns the value of attribute exact_url.
5 6 7 |
# File 'lib/exact/client.rb', line 5 def exact_url @exact_url end |
#service ⇒ Object
Returns the value of attribute service.
6 7 8 |
# File 'lib/exact/client.rb', line 6 def service @service end |