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.



25064
25065
25066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25064

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25062
25063
25064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25062

def value
  @value
end

Class Method Details

.ALLObject



25084
25085
25086
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25084

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



25069
25070
25071
25072
25073
25074
25075
25076
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25069

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



25088
25089
25090
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25088

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



25079
25080
25081
25082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25079

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

.pinObject



25092
25093
25094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25092

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

.postalObject



25096
25097
25098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25096

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

.zipObject



25100
25101
25102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25100

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

Instance Method Details

#to_hashObject



25104
25105
25106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25104

def to_hash
  value
end