Class: Io::Flow::V0::Models::GraphqlResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ GraphqlResponse

Returns a new instance of GraphqlResponse.



44400
44401
44402
44403
44404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44400

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

#dataObject (readonly)

Returns the value of attribute data.



44398
44399
44400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44398

def data
  @data
end

#errorsObject (readonly)

Returns the value of attribute errors.



44398
44399
44400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44398

def errors
  @errors
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44410
44411
44412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44410

def copy(incoming={})
  GraphqlResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



44414
44415
44416
44417
44418
44419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44414

def to_hash
  {
    :data => data,
    :errors => errors.nil? ? nil : errors
  }
end

#to_jsonObject



44406
44407
44408
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44406

def to_json
  JSON.dump(to_hash)
end