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.



18115
18116
18117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18115

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18113
18114
18115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18113

def value
  @value
end

Class Method Details

.ALLObject



18135
18136
18137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18135

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



18120
18121
18122
18123
18124
18125
18126
18127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18120

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)



18147
18148
18149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18147

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

.experienceObject

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



18141
18142
18143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18141

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



18130
18131
18132
18133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18130

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



18151
18152
18153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18151

def to_hash
  value
end