Class: KcoRuby::Connector
- Inherits:
-
Object
- Object
- KcoRuby::Connector
- Defined in:
- lib/kco_ruby/connector.rb
Overview
Responsible for connections against API
Instance Attribute Summary collapse
-
#digester ⇒ Object
readonly
Returns the value of attribute digester.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
-
#apply(method, resource, options = {}) ⇒ Object
Apply will carryout the order with the collaborators.
-
#initialize(user_agent, digester) ⇒ Connector
constructor
A new instance of Connector.
Constructor Details
#initialize(user_agent, digester) ⇒ Connector
Returns a new instance of Connector.
10 11 12 13 |
# File 'lib/kco_ruby/connector.rb', line 10 def initialize(user_agent, digester) @user_agent = user_agent @digester =digester end |
Instance Attribute Details
#digester ⇒ Object (readonly)
Returns the value of attribute digester.
8 9 10 |
# File 'lib/kco_ruby/connector.rb', line 8 def digester @digester end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
8 9 10 |
# File 'lib/kco_ruby/connector.rb', line 8 def user_agent @user_agent end |
Instance Method Details
#apply(method, resource, options = {}) ⇒ Object
Apply will carryout the order with the collaborators
16 17 18 19 20 21 |
# File 'lib/kco_ruby/connector.rb', line 16 def apply(method, resource, ={}) uri = URI(['url'] || resource.location) request_context = RequestContext.new(uri, resource, self) request_context.parse(method, ) ResponseHandler.new(request_context.perform_request, resource).handle_response end |