Class: Io::Flow::V0::Models::CountryPicker

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

Overview

The Country Picker manages the configuration of your country picker.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CountryPicker

Returns a new instance of CountryPicker.



37195
37196
37197
37198
37199
37200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37195

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



37193
37194
37195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37193

def id
  @id
end

#sourceObject (readonly)

Returns the value of attribute source.



37193
37194
37195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37193

def source
  @source
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37206
37207
37208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37206

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

#to_hashObject



37210
37211
37212
37213
37214
37215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37210

def to_hash
  {
    :id => id,
    :source => source.value
  }
end

#to_jsonObject



37202
37203
37204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37202

def to_json
  JSON.dump(to_hash)
end