Class: SynsbasenApi::ApiResponse
- Inherits:
 - 
      Object
      
        
- Object
 - SynsbasenApi::ApiResponse
 
 
- Defined in:
 - lib/synsbasen_api/api_response.rb
 
Overview
The ApiResponse class represents the response structure from the Synsbasen API.
Instance Attribute Summary collapse
- 
  
    
      #cost  ⇒ Numeric 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The cost associated with the API response.
 - 
  
    
      #data  ⇒ Hash 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The data included in the API response.
 - 
  
    
      #has_more  ⇒ Boolean 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Indicates whether there is more data available in the response.
 - 
  
    
      #page  ⇒ Numeric 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The current page number.
 - 
  
    
      #total_count  ⇒ Numeric 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The total count of items available.
 - 
  
    
      #total_pages  ⇒ Numeric 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The total number of pages available.
 
Instance Method Summary collapse
- 
  
    
      #initialize(response)  ⇒ ApiResponse 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initializes a new instance of
ApiResponsewith the provided response data. 
Constructor Details
#initialize(response) ⇒ ApiResponse
Initializes a new instance of ApiResponse with the provided response data.
      32 33 34 35 36 37 38 39  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 32 def initialize(response) @data = response[:data] @cost = response[:cost] %i[has_more page total_pages total_count].each do |key| instance_variable_set("@#{key}", response[key]) if response.key?(key) end end  | 
  
Instance Attribute Details
#cost ⇒ Numeric (readonly)
Returns The cost associated with the API response.
      10 11 12  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 10 def cost @cost end  | 
  
#data ⇒ Hash (readonly)
Returns The data included in the API response.
      7 8 9  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 7 def data @data end  | 
  
#has_more ⇒ Boolean (readonly)
Returns Indicates whether there is more data available in the response.
      13 14 15  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 13 def has_more @has_more end  | 
  
#page ⇒ Numeric (readonly)
Returns The current page number.
      16 17 18  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 16 def page @page end  | 
  
#total_count ⇒ Numeric (readonly)
Returns The total count of items available.
      22 23 24  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 22 def total_count @total_count end  | 
  
#total_pages ⇒ Numeric (readonly)
Returns The total number of pages available.
      19 20 21  | 
    
      # File 'lib/synsbasen_api/api_response.rb', line 19 def total_pages @total_pages end  |