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.



32897
32898
32899
32900
32901
32902
32903
32904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32897

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.



32895
32896
32897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32895

def id
  @id
end

#optin_responsesObject (readonly)

Returns the value of attribute optin_responses.



32895
32896
32897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32895

def optin_responses
  @optin_responses
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



32895
32896
32897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32895

def order_number
  @order_number
end

#session_idObject (readonly)

Returns the value of attribute session_id.



32895
32896
32897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32895

def session_id
  @session_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32910
32911
32912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32910

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

#to_hashObject



32914
32915
32916
32917
32918
32919
32920
32921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32914

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



32906
32907
32908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32906

def to_json
  JSON.dump(to_hash)
end