Class: Served::HTTPClient
- Inherits:
-
Object
- Object
- Served::HTTPClient
- Defined in:
- lib/served/http_client.rb
Overview
Provides an interface between the HTTP client and the Resource.
Defined Under Namespace
Classes: ConnectionFailed
Constant Summary collapse
- DEFAULT_TEMPLATE =
'{/resource*}{/id}.json{?query*}'.freeze
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(resource) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
Constructor Details
#initialize(resource) ⇒ HTTPClient
Returns a new instance of HTTPClient.
20 21 22 23 24 25 |
# File 'lib/served/http_client.rb', line 20 def initialize(resource) @resource = resource h = host + @resource.template @template = Addressable::Template.new(h) @backend = Served::Backends[Served.config.backend].new(self) end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
9 10 11 |
# File 'lib/served/http_client.rb', line 9 def resource @resource end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
9 10 11 |
# File 'lib/served/http_client.rb', line 9 def template @template end |