Class: Io::Flow::V0::Models::OptinResponse

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

Returns a new instance of OptinResponse.



51127
51128
51129
51130
51131
51132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51127

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :value], 'OptinResponse')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::OptinResponseType) ? x : ::Io::Flow::V0::Models::OptinResponseType.apply(x))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



51125
51126
51127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51125

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



51125
51126
51127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51125

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51138
51139
51140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51138

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

#to_hashObject



51142
51143
51144
51145
51146
51147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51142

def to_hash
  {
    :key => key,
    :value => value.value
  }
end

#to_jsonObject



51134
51135
51136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51134

def to_json
  JSON.dump(to_hash)
end