Class: Io::Flow::V0::Models::CheckoutOptinResponses

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 = {}) ⇒ CheckoutOptinResponses

Returns a new instance of CheckoutOptinResponses.



26760
26761
26762
26763
26764
26765
26766
26767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26760

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :order_number, :session_id, :optin_responses], 'CheckoutOptinResponses')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @session_id = HttpClient::Preconditions.assert_class('session_id', opts.delete(:session_id), String)
  @optin_responses = HttpClient::Preconditions.assert_class('optin_responses', opts.delete(:optin_responses), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OptinResponse) ? x : ::Io::Flow::V0::Models::OptinResponse.new(x)) }
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



26758
26759
26760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26758

def id
  @id
end

#optin_responsesObject (readonly)

Returns the value of attribute optin_responses.



26758
26759
26760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26758

def optin_responses
  @optin_responses
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



26758
26759
26760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26758

def order_number
  @order_number
end

#session_idObject (readonly)

Returns the value of attribute session_id.



26758
26759
26760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26758

def session_id
  @session_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26773
26774
26775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26773

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

#to_hashObject



26777
26778
26779
26780
26781
26782
26783
26784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26777

def to_hash
  {
    :id => id,
    :order_number => order_number,
    :session_id => session_id,
    :optin_responses => optin_responses.map { |o| o.to_hash }
  }
end

#to_jsonObject



26769
26770
26771
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26769

def to_json
  JSON.dump(to_hash)
end