Class: Minter::Api::Result
- Inherits:
- 
      Object
      
        - Object
- Minter::Api::Result
 
- Defined in:
- lib/minter/api/result.rb
Instance Attribute Summary collapse
- 
  
    
      #body  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute body. 
- 
  
    
      #headers  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute headers. 
- 
  
    
      #status  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute status. 
Instance Method Summary collapse
- 
  
    
      #initialize(response, **options)  ⇒ Result 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Result. 
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(response, **options) ⇒ Result
Returns a new instance of Result.
| 8 9 10 11 12 13 14 | # File 'lib/minter/api/result.rb', line 8 def initialize(response, **) handle_error_response(response) if !response.status.success? && ![:suppress_errors] @headers = response.headers @body = JSON.parse(response.body) @status = response.status end | 
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
| 6 7 8 | # File 'lib/minter/api/result.rb', line 6 def body @body end | 
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
| 6 7 8 | # File 'lib/minter/api/result.rb', line 6 def headers @headers end | 
#status ⇒ Object (readonly)
Returns the value of attribute status.
| 6 7 8 | # File 'lib/minter/api/result.rb', line 6 def status @status end | 
Instance Method Details
#to_h ⇒ Object
| 16 17 18 19 20 21 22 | # File 'lib/minter/api/result.rb', line 16 def to_h { headers: @headers.to_h, body: @body, status: @status.code } end | 
#to_s ⇒ Object
| 24 25 26 | # File 'lib/minter/api/result.rb', line 24 def to_s to_h.slice(:body, :status).to_s end |