Class: Io::Flow::V0::Models::PostalType

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

Returns a new instance of PostalType.



21882
21883
21884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21882

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21880
21881
21882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21880

def value
  @value
end

Class Method Details

.ALLObject



21902
21903
21904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21902

def PostalType.ALL
  @@all ||= [PostalType.eircode, PostalType.pin, PostalType.postal, PostalType.zip]
end

.apply(value) ⇒ Object

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



21887
21888
21889
21890
21891
21892
21893
21894
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21887

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

.eircodeObject



21906
21907
21908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21906

def PostalType.eircode
  @@_eircode ||= PostalType.new('eircode')
end

.from_string(value) ⇒ Object

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



21897
21898
21899
21900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21897

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

.pinObject



21910
21911
21912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21910

def PostalType.pin
  @@_pin ||= PostalType.new('pin')
end

.postalObject



21914
21915
21916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21914

def PostalType.postal
  @@_postal ||= PostalType.new('postal')
end

.zipObject



21918
21919
21920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21918

def PostalType.zip
  @@_zip ||= PostalType.new('zip')
end

Instance Method Details

#to_hashObject



21922
21923
21924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21922

def to_hash
  value
end