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.



13595
13596
13597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13595

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13593
13594
13595
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13593

def value
  @value
end

Class Method Details

.ALLObject



13615
13616
13617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13615

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



13600
13601
13602
13603
13604
13605
13606
13607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13600

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)



13627
13628
13629
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13627

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

.experienceObject

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



13621
13622
13623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13621

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



13610
13611
13612
13613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13610

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



13631
13632
13633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13631

def to_hash
  value
end