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.
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/audiosearch.rb', line 190 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
211 212 213 214 215 216 217 |
# File 'lib/audiosearch.rb', line 211 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.
188 189 190 |
# File 'lib/audiosearch.rb', line 188 def http_resp @http_resp end |
Instance Method Details
#is_success ⇒ Object
207 208 209 |
# File 'lib/audiosearch.rb', line 207 def is_success() return @is_ok end |
#respond_to?(meth) ⇒ Boolean
219 220 221 222 223 224 225 |
# File 'lib/audiosearch.rb', line 219 def respond_to?(meth) if @http_resp.body.respond_to? meth true else super end end |
#status ⇒ Object
203 204 205 |
# File 'lib/audiosearch.rb', line 203 def status() return @http_resp.status end |