Class: Io::Flow::V0::Models::CountryPickerSource

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ CountryPickerSource

Returns a new instance of CountryPickerSource.



16797
16798
16799
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16797

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16795
16796
16797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16795

def value
  @value
end

Class Method Details

.ALLObject



16817
16818
16819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16817

def CountryPickerSource.ALL
  @@all ||= [CountryPickerSource.experience, CountryPickerSource.destination]
end

.apply(value) ⇒ Object

Returns the instance of CountryPickerSource for this value, creating a new instance for an unknown value



16802
16803
16804
16805
16806
16807
16808
16809
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16802

def CountryPickerSource.apply(value)
  if value.instance_of?(CountryPickerSource)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || CountryPickerSource.new(value))
  end
end

.destinationObject

Indicates we should build the list of countries based on all countries to which you have a rate card (ie. all valid destination countries)



16829
16830
16831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16829

def CountryPickerSource.destination
  @@_destination ||= CountryPickerSource.new('destination')
end

.experienceObject

Indicates we should build the list of countries based on each active experience country



16823
16824
16825
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16823

def CountryPickerSource.experience
  @@_experience ||= CountryPickerSource.new('experience')
end

.from_string(value) ⇒ Object

Returns the instance of CountryPickerSource for this value, or nil if not found



16812
16813
16814
16815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16812

def CountryPickerSource.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  CountryPickerSource.ALL.find { |v| v.value == value }
end

Instance Method Details

#to_hashObject



16833
16834
16835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16833

def to_hash
  value
end