Class: Audiosearch::Response
- Inherits:
-
Object
- Object
- Audiosearch::Response
- Defined in:
- lib/audiosearch.rb
Overview
dependent classes
Instance Attribute Summary collapse
-
#http_resp ⇒ Object
Returns the value of attribute http_resp.
Instance Method Summary collapse
-
#initialize(http_resp) ⇒ Response
constructor
A new instance of Response.
- #is_success ⇒ Object
- #method_missing(meth, *args, &block) ⇒ Object
- #respond_to?(meth) ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(http_resp) ⇒ Response
Returns a new instance of Response.
191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/audiosearch.rb', line 191 def initialize(http_resp) @http_resp = http_resp #warn http_resp.headers.inspect #warn "code=" + http_resp.status.to_s @is_ok = false if http_resp.status.to_s =~ /^2\d\d/ @is_ok = true end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
212 213 214 215 216 217 218 |
# File 'lib/audiosearch.rb', line 212 def method_missing(meth, *args, &block) if @http_resp.body.respond_to? meth @http_resp.body.send(meth, *args, &block) else super end end |
Instance Attribute Details
#http_resp ⇒ Object
Returns the value of attribute http_resp.
189 190 191 |
# File 'lib/audiosearch.rb', line 189 def http_resp @http_resp end |
Instance Method Details
#is_success ⇒ Object
208 209 210 |
# File 'lib/audiosearch.rb', line 208 def is_success() return @is_ok end |
#respond_to?(meth) ⇒ Boolean
220 221 222 223 224 225 226 |
# File 'lib/audiosearch.rb', line 220 def respond_to?(meth) if @http_resp.body.respond_to? meth true else super end end |
#status ⇒ Object
204 205 206 |
# File 'lib/audiosearch.rb', line 204 def status() return @http_resp.status end |