Class: Io::Flow::V0::Models::GraphqlResponse
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::GraphqlResponse
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ GraphqlResponse
constructor
A new instance of GraphqlResponse.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ GraphqlResponse
Returns a new instance of GraphqlResponse.
39331 39332 39333 39334 39335 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39331 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @data = (x = opts.delete(:data); x.nil? ? nil : HttpClient::Preconditions.assert_class('data', HttpClient::Helper.to_object(x), Hash)) @errors = (x = opts.delete(:errors); x.nil? ? nil : HttpClient::Preconditions.assert_class('errors', x, Array).map { |v| HttpClient::Preconditions.assert_class('errors', HttpClient::Helper.to_object(v), Hash) }) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
39329 39330 39331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39329 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
39329 39330 39331 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39329 def errors @errors end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39341 39342 39343 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39341 def copy(incoming={}) GraphqlResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39345 39346 39347 39348 39349 39350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39345 def to_hash { :data => data, :errors => errors.nil? ? nil : errors } end |
#to_json ⇒ Object
39337 39338 39339 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39337 def to_json JSON.dump(to_hash) end |