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.
-
#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.
33204 33205 33206 33207 33208 33209 33210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33204 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:request_id, :data], 'GraphqlResponse') @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.
33202 33203 33204 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33202 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
33202 33203 33204 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33202 def errors @errors end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
33202 33203 33204 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33202 def request_id @request_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def copy(incoming={}) GraphqlResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33220 33221 33222 33223 33224 33225 33226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33220 def to_hash { :request_id => request_id, :data => data, :errors => errors.nil? ? nil : errors } end |
#to_json ⇒ Object
33212 33213 33214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33212 def to_json JSON.dump(to_hash) end |