Class: BreakingBad::Client
- Inherits:
-
Object
- Object
- BreakingBad::Client
- Defined in:
- lib/breaking_bad/client.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(uri) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(uri) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/breaking_bad/client.rb', line 9 def initialize(uri) @uri = uri @response = nil end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/breaking_bad/client.rb', line 7 def response @response end |
#uri ⇒ Object
Returns the value of attribute uri.
7 8 9 |
# File 'lib/breaking_bad/client.rb', line 7 def uri @uri end |
Instance Method Details
#get(path) ⇒ Object
14 15 16 17 18 |
# File 'lib/breaking_bad/client.rb', line 14 def get(path) uri = URI.join(@uri, path) response = Net::HTTP.get_response(uri) @response = JSON.parse(response.body, symbolize_names: true) end |