Class: Unit::Resource::BaseResource
- Inherits:
-
Object
- Object
- Unit::Resource::BaseResource
- Defined in:
- lib/unit/api_resources/base_resource.rb
Direct Known Subclasses
AccountResource, ApiTokenResource, ApplicationFormResource, ApplicationResource, AtmLocationResource, AuthorizationRequestResource, AuthorizationResource, CardResource, CheckDepositResource, CheckPaymentResource, CounterpartyResource, CustomerResource, EventResource, FeeResource, InstitutionResource, PaymentResource, ReceivedPaymentResource, RecurringPaymentResource, RepaymentResource, RewardResource, StatementResource, TransactionResource, WebhookResource
Class Method Summary collapse
- .file_response_handler(response) ⇒ Object
-
.response_handler(response) ⇒ Object
Check the response code and return a UnitResponse or UnitError.
Class Method Details
.file_response_handler(response) ⇒ Object
14 15 16 |
# File 'lib/unit/api_resources/base_resource.rb', line 14 def file_response_handler(response) response.code.to_i.between?(200, 299) ? response.body : Unit::UnitError end |
.response_handler(response) ⇒ Object
Check the response code and return a UnitResponse or UnitError
9 10 11 12 |
# File 'lib/unit/api_resources/base_resource.rb', line 9 def response_handler(response) handler = response.code.to_i.between?(200, 299) ? Unit::UnitResponse : Unit::UnitError handler.from_json_api(response) end |