Class: Io::Flow::V0::Models::BrowseOptinResponses

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

Returns a new instance of BrowseOptinResponses.



29986
29987
29988
29989
29990
29991
29992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29986

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :session_id, :optin_responses], 'BrowseOptinResponses')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), 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.



29984
29985
29986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29984

def id
  @id
end

#optin_responsesObject (readonly)

Returns the value of attribute optin_responses.



29984
29985
29986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29984

def optin_responses
  @optin_responses
end

#session_idObject (readonly)

Returns the value of attribute session_id.



29984
29985
29986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29984

def session_id
  @session_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29998
29999
30000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29998

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

#to_hashObject



30002
30003
30004
30005
30006
30007
30008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30002

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

#to_jsonObject



29994
29995
29996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29994

def to_json
  JSON.dump(to_hash)
end