Class: Io::Flow::V0::Models::OrderError
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderError
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
GenericError, OrderErrorUndefinedType, OrderItemNotAvailableError
Defined Under Namespace
Modules: Types
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ OrderError
constructor
A new instance of OrderError.
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderError
Returns a new instance of OrderError.
4469 4470 4471 4472 4473 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4469 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name], 'OrderError') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) end |
Class Method Details
.from_json(hash) ⇒ Object
4479 4480 4481 4482 4483 4484 4485 4486 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4479 def OrderError.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) case HttpClient::Helper.symbolize_keys(hash)[:code] when Types::ORDER_ITEM_NOT_AVAILABLE_ERROR; OrderItemNotAvailableError.new(hash) when Types::GENERIC_ERROR; GenericError.new(hash) else OrderErrorUndefinedType.new(:name => union_type_name) end end |
Instance Method Details
#to_hash ⇒ Object
4475 4476 4477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4475 def to_hash subtype_to_hash.merge(:code => @name) end |