Class: Io::Flow::V0::Models::GraphqlRequest
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::GraphqlRequest
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#operation_name ⇒ Object
readonly
Returns the value of attribute operation_name.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ GraphqlRequest
constructor
A new instance of GraphqlRequest.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ GraphqlRequest
Returns a new instance of GraphqlRequest.
44370 44371 44372 44373 44374 44375 44376 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44370 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:query], 'GraphqlRequest') @query = HttpClient::Preconditions.assert_class('query', opts.delete(:query), String) @operation_name = (x = opts.delete(:operation_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('operation_name', x, String)) @variables = (x = opts.delete(:variables); x.nil? ? nil : HttpClient::Preconditions.assert_class('variables', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('variables', d[1], String); h }) end |
Instance Attribute Details
#operation_name ⇒ Object (readonly)
Returns the value of attribute operation_name.
44368 44369 44370 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44368 def operation_name @operation_name end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
44368 44369 44370 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44368 def query @query end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
44368 44369 44370 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44368 def variables @variables end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
44382 44383 44384 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44382 def copy(incoming={}) GraphqlRequest.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
44386 44387 44388 44389 44390 44391 44392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44386 def to_hash { :query => query, :operation_name => operation_name, :variables => variables.nil? ? nil : variables } end |
#to_json ⇒ Object
44378 44379 44380 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44378 def to_json JSON.dump(to_hash) end |