Class: Belpost::Models::ApiResponse
- Inherits:
-
Object
- Object
- Belpost::Models::ApiResponse
- Defined in:
- lib/belpost/models/api_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(data:, status_code:, headers:) ⇒ ApiResponse
constructor
A new instance of ApiResponse.
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(data:, status_code:, headers:) ⇒ ApiResponse
Returns a new instance of ApiResponse.
8 9 10 11 12 |
# File 'lib/belpost/models/api_response.rb', line 8 def initialize(data:, status_code:, headers:) @data = data @status_code = status_code @headers = headers end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/belpost/models/api_response.rb', line 6 def data @data end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/belpost/models/api_response.rb', line 6 def headers @headers end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/belpost/models/api_response.rb', line 6 def status_code @status_code end |
Instance Method Details
#success? ⇒ Boolean
14 15 16 |
# File 'lib/belpost/models/api_response.rb', line 14 def success? status_code == 200 end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/belpost/models/api_response.rb', line 18 def to_h data end |