Class: Io::Flow::V0::Models::Error
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Error
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents an error of some sort (e.g. invalid input). Each error will contain a code and a specific message describing the failure.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Error
constructor
A new instance of Error.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Error
Returns a new instance of Error.
8088 8089 8090 8091 8092 8093 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8088 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:code, :message], 'Error') @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String) = HttpClient::Preconditions.assert_class('message', opts.delete(:message), String) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8086 8087 8088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8086 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8086 8087 8088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8086 def end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
8099 8100 8101 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8099 def copy(incoming={}) Error.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
8103 8104 8105 8106 8107 8108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8103 def to_hash { :code => code, :message => } end |
#to_json ⇒ Object
8095 8096 8097 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8095 def to_json JSON.dump(to_hash) end |