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.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
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.
33098 33099 33100 33101 33102 33103 33104 33105 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33098 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :request_id, :data], 'GraphqlResponse') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @request_id = HttpClient::Preconditions.assert_class('request_id', opts.delete(:request_id), String) @data = HttpClient::Preconditions.assert_class('data', HttpClient::Helper.to_object(opts.delete(:data)), 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.
33096 33097 33098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33096 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
33096 33097 33098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33096 def errors @errors end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
33096 33097 33098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33096 def id @id end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
33096 33097 33098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33096 def request_id @request_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33111 33112 33113 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33111 def copy(incoming={}) GraphqlResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33115 33116 33117 33118 33119 33120 33121 33122 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33115 def to_hash { :id => id, :request_id => request_id, :data => data, :errors => errors.nil? ? nil : errors } end |
#to_json ⇒ Object
33107 33108 33109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33107 def to_json JSON.dump(to_hash) end |