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.



25861
25862
25863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25861

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25859
25860
25861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25859

def value
  @value
end

Class Method Details

.ALLObject



25881
25882
25883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25881

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



25866
25867
25868
25869
25870
25871
25872
25873
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25866

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



25876
25877
25878
25879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876

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

.jurisdictionObject



25893
25894
25895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25893

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

.provinceObject



25889
25890
25891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25889

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

.stateObject



25885
25886
25887
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25885

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

Instance Method Details

#to_hashObject



25897
25898
25899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25897

def to_hash
  value
end