Class: Roe::Client
- Inherits:
-
Object
- Object
- Roe::Client
- Defined in:
- lib/roe/client.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#format ⇒ Object
Returns the value of attribute format.
Instance Method Summary collapse
-
#initialize(endpoint, format = :json) ⇒ Client
constructor
A new instance of Client.
- #resolve(uri, options = {}) ⇒ Object
Constructor Details
#initialize(endpoint, format = :json) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 |
# File 'lib/roe/client.rb', line 9 def initialize(endpoint, format = :json) @endpoint = endpoint @format = format Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", Roe.[key]) end end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/roe/client.rb', line 6 def endpoint @endpoint end |
#format ⇒ Object
Returns the value of attribute format.
6 7 8 |
# File 'lib/roe/client.rb', line 6 def format @format end |
Instance Method Details
#resolve(uri, options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/roe/client.rb', line 18 def resolve(uri, ={}) response = connection.get do |req| req.url endpoint_path, .merge!(:url => uri, :format => format) end response.body. || response.body end |