Class: KOSapiClient::ApiClient
- Inherits:
-
Object
- Object
- KOSapiClient::ApiClient
- Includes:
- ResourceMapper
- Defined in:
- lib/kosapi_client/api_client.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
- #create_builder(resource_name) ⇒ Object
-
#initialize(config = Configuration.new) ⇒ ApiClient
constructor
Creates a new KOSapi client.
Methods included from ResourceMapper
Constructor Details
#initialize(config = Configuration.new) ⇒ ApiClient
Creates a new KOSapi client.
24 25 26 27 |
# File 'lib/kosapi_client/api_client.rb', line 24 def initialize(config = Configuration.new) http_adapter = OAuth2HttpAdapter.new(config.credentials, config.base_url, config.to_h) @http_client = HTTPClient.new(http_adapter) end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
19 20 21 |
# File 'lib/kosapi_client/api_client.rb', line 19 def http_client @http_client end |
Instance Method Details
#create_builder(resource_name) ⇒ Object
29 30 31 32 33 |
# File 'lib/kosapi_client/api_client.rb', line 29 def create_builder(resource_name) builder_name = "#{resource_name}_builder".camelcase(:upper).to_sym builder_class = find_builder_class(builder_name) builder_class.new(resource_name.to_s.camelcase(:lower), @http_client) end |