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.



27339
27340
27341
27342
27343
27344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27339

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.



27337
27338
27339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27337

def id
  @id
end

#sourceObject (readonly)

Returns the value of attribute source.



27337
27338
27339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27337

def source
  @source
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27350
27351
27352
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27350

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

#to_hashObject



27354
27355
27356
27357
27358
27359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27354

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

#to_jsonObject



27346
27347
27348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27346

def to_json
  JSON.dump(to_hash)
end