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.
23 24 25 26 |
# File 'lib/kosapi_client/api_client.rb', line 23 def initialize(config = Configuration.new) http_adapter = OAuth2HttpAdapter.new(config.credentials, config.base_url) @http_client = HTTPClient.new(http_adapter) end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
18 19 20 |
# File 'lib/kosapi_client/api_client.rb', line 18 def http_client @http_client end |
Instance Method Details
#create_builder(resource_name) ⇒ Object
28 29 30 31 32 |
# File 'lib/kosapi_client/api_client.rb', line 28 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 |