Class: TableCheckApi::Pos::V1::BaseResponse
- Inherits:
-
Object
- Object
- TableCheckApi::Pos::V1::BaseResponse
show all
- Defined in:
- lib/table_check_api/pos/v1/base_response.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseResponse.
13
14
15
16
|
# File 'lib/table_check_api/pos/v1/base_response.rb', line 13
def initialize(response)
raw_body = response.respond_to?(:body) ? response.body : response
@body = parse_body(raw_body)
end
|
Class Method Details
.from_response(response) ⇒ Object
9
10
11
|
# File 'lib/table_check_api/pos/v1/base_response.rb', line 9
def self.from_response(response)
new(response)
end
|
Instance Method Details
#errors ⇒ Object
24
25
26
|
# File 'lib/table_check_api/pos/v1/base_response.rb', line 24
def errors
@body['errors'] || []
end
|
#raw ⇒ Object
Also known as:
body
18
19
20
|
# File 'lib/table_check_api/pos/v1/base_response.rb', line 18
def raw
@body
end
|
#success? ⇒ Boolean
28
29
30
|
# File 'lib/table_check_api/pos/v1/base_response.rb', line 28
def success?
errors.empty?
end
|