Class: ResoWebApi::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- ResoWebApi::Client
- Includes:
- Resources
- Defined in:
- lib/reso_web_api/client.rb
Overview
Main class to run requests against a RESO Web API server.
Constant Summary
Constants included from Resources
Constants inherited from BaseClient
Instance Method Summary collapse
-
#connection(&block) ⇒ Faraday::Connection
Return the Faraday::Connection object for this client.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#service ⇒ FrOData::Service
Returns a proxied FrOData::Service that attempts to ensure a properly authenticated and authorized connection.
-
#service_options ⇒ Hash
Returns the default options used by the by the OData service.
Methods included from Resources
Methods inherited from BaseClient
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 |
# File 'lib/reso_web_api/client.rb', line 15 def initialize( = {}) super() ensure_valid_auth_strategy! end |
Instance Method Details
#connection(&block) ⇒ Faraday::Connection
Return the Faraday::Connection object for this client. Yields the connection object being constructed (for customzing middleware).
23 24 25 26 27 28 |
# File 'lib/reso_web_api/client.rb', line 23 def connection(&block) super do |conn| conn.use Authentication::Middleware, @auth yield conn if block_given? end end |
#service ⇒ FrOData::Service
Returns a proxied FrOData::Service that attempts to ensure a properly authenticated and authorized connection
33 34 35 36 |
# File 'lib/reso_web_api/client.rb', line 33 def service # puts odata, service_options @service ||= FrOData::Service.new(connection, ) end |
#service_options ⇒ Hash
Returns the default options used by the by the OData service
40 41 42 |
# File 'lib/reso_web_api/client.rb', line 40 def ||= { logger: logger }.merge(odata || {}) end |