Class: Dryer::Clients::GeneratedClients::Responses::Create
- Inherits:
-
Services::ResultService
- Object
- Services::ResultService
- Dryer::Clients::GeneratedClients::Responses::Create
- Defined in:
- lib/dryer/clients/generated_clients/responses/create.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(raw_response:, response_contracts:) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(raw_response:, response_contracts:) ⇒ Create
Returns a new instance of Create.
8 9 10 11 12 13 14 |
# File 'lib/dryer/clients/generated_clients/responses/create.rb', line 8 def initialize( raw_response:, response_contracts: ) @raw_response = raw_response @response_contracts = response_contracts end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dryer/clients/generated_clients/responses/create.rb', line 16 def call errors = validation_errors( raw_response.body, response_contracts[raw_response.code] ) if errors.empty? Success( Response.new( raw_response: raw_response, errors: errors ) ) else Failure( StandardError.new({ code: raw_response.code, body: raw_response.body, errors: errors.to_h }) ) end end |