Class: Zencoder::Response
- Inherits:
- 
      Object
      
        - Object
- Zencoder::Response
 
- Defined in:
- lib/zencoder/response.rb
Instance Attribute Summary collapse
- 
  
    
      #body  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute body. 
- 
  
    
      #code  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute code. 
- 
  
    
      #raw_body  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute raw_body. 
- 
  
    
      #raw_response  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute raw_response. 
- 
  
    
      #request  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute request. 
Instance Method Summary collapse
- #body_without_wrapper ⇒ Object
- #errors ⇒ Object
- 
  
    
      #initialize(options = {})  ⇒ Response 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Response. 
- #success? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Response
Returns a new instance of Response.
| 6 7 8 9 10 | # File 'lib/zencoder/response.rb', line 6 def initialize(={}) .each do |k, v| send("#{k}=", v) if respond_to?("#{k}=") end end | 
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
| 4 5 6 | # File 'lib/zencoder/response.rb', line 4 def body @body end | 
#code ⇒ Object
Returns the value of attribute code.
| 4 5 6 | # File 'lib/zencoder/response.rb', line 4 def code @code end | 
#raw_body ⇒ Object
Returns the value of attribute raw_body.
| 4 5 6 | # File 'lib/zencoder/response.rb', line 4 def raw_body @raw_body end | 
#raw_response ⇒ Object
Returns the value of attribute raw_response.
| 4 5 6 | # File 'lib/zencoder/response.rb', line 4 def raw_response @raw_response end | 
#request ⇒ Object
Returns the value of attribute request.
| 4 5 6 | # File 'lib/zencoder/response.rb', line 4 def request @request end | 
Instance Method Details
#body_without_wrapper ⇒ Object
| 24 25 26 27 28 29 30 | # File 'lib/zencoder/response.rb', line 24 def body_without_wrapper if body.is_a?(Hash) && body['api_response'] body['api_response'] else body end end | 
#errors ⇒ Object
| 16 17 18 19 20 21 22 | # File 'lib/zencoder/response.rb', line 16 def errors if body.is_a?(Hash) Array(body['errors']).compact else [] end end | 
#success? ⇒ Boolean
| 12 13 14 | # File 'lib/zencoder/response.rb', line 12 def success? code.to_i > 199 && code.to_i < 300 end |