Class: Io::Flow::V0::Models::UnitOfTime

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

Returns a new instance of UnitOfTime.



28179
28180
28181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28179

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



28177
28178
28179
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28177

def value
  @value
end

Class Method Details

.ALLObject



28199
28200
28201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28199

def UnitOfTime.ALL
  @@all ||= [UnitOfTime.year, UnitOfTime.month, UnitOfTime.week, UnitOfTime.day, UnitOfTime.hour, UnitOfTime.minute]
end

.apply(value) ⇒ Object

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



28184
28185
28186
28187
28188
28189
28190
28191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28184

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

.dayObject



28215
28216
28217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28215

def UnitOfTime.day
  @@_day ||= UnitOfTime.new('day')
end

.from_string(value) ⇒ Object

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



28194
28195
28196
28197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28194

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

.hourObject



28219
28220
28221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28219

def UnitOfTime.hour
  @@_hour ||= UnitOfTime.new('hour')
end

.minuteObject



28223
28224
28225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28223

def UnitOfTime.minute
  @@_minute ||= UnitOfTime.new('minute')
end

.monthObject



28207
28208
28209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28207

def UnitOfTime.month
  @@_month ||= UnitOfTime.new('month')
end

.weekObject



28211
28212
28213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28211

def UnitOfTime.week
  @@_week ||= UnitOfTime.new('week')
end

.yearObject



28203
28204
28205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28203

def UnitOfTime.year
  @@_year ||= UnitOfTime.new('year')
end

Instance Method Details

#to_hashObject



28227
28228
28229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28227

def to_hash
  value
end