Class: LadyGaga::Response
- Inherits:
-
Object
- Object
- LadyGaga::Response
- Defined in:
- lib/lady_gaga/response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
- #xml ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/lady_gaga/response.rb', line 6 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Object
10 11 12 |
# File 'lib/lady_gaga/response.rb', line 10 def body response.body end |
#code ⇒ Object
18 19 20 |
# File 'lib/lady_gaga/response.rb', line 18 def code response.code end |
#to_h ⇒ Object
14 15 16 |
# File 'lib/lady_gaga/response.rb', line 14 def to_h response.to_hash end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/lady_gaga/response.rb', line 22 def valid? code == 200 end |
#xml ⇒ Object
26 27 28 |
# File 'lib/lady_gaga/response.rb', line 26 def xml @xml ||= Nokogiri::XML(body) end |