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.



23019
23020
23021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23019

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



23017
23018
23019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23017

def value
  @value
end

Class Method Details

.ALLObject



23039
23040
23041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23039

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



23024
23025
23026
23027
23028
23029
23030
23031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23024

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



23043
23044
23045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23043

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



23034
23035
23036
23037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23034

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

.pinObject



23047
23048
23049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23047

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

.postalObject



23051
23052
23053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23051

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

.zipObject



23055
23056
23057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23055

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

Instance Method Details

#to_hashObject



23059
23060
23061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23059

def to_hash
  value
end