Class: Io::Flow::V0::Models::RegionType

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) ⇒ RegionType

Returns a new instance of RegionType.



23816
23817
23818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23816

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



23814
23815
23816
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23814

def value
  @value
end

Class Method Details

.ALLObject



23836
23837
23838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23836

def RegionType.ALL
  @@all ||= [RegionType.state, RegionType.province, RegionType.jurisdiction]
end

.apply(value) ⇒ Object

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



23821
23822
23823
23824
23825
23826
23827
23828
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23821

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

.from_string(value) ⇒ Object

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



23831
23832
23833
23834
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23831

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

.jurisdictionObject



23848
23849
23850
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23848

def RegionType.jurisdiction
  @@_jurisdiction ||= RegionType.new('jurisdiction')
end

.provinceObject



23844
23845
23846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23844

def RegionType.province
  @@_province ||= RegionType.new('province')
end

.stateObject



23840
23841
23842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23840

def RegionType.state
  @@_state ||= RegionType.new('state')
end

Instance Method Details

#to_hashObject



23852
23853
23854
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23852

def to_hash
  value
end