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.



6373
6374
6375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6373

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6371
6372
6373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6371

def value
  @value
end

Class Method Details

.ALLObject



6393
6394
6395
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6393

def UnitOfTime.ALL
  @@all ||= [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



6378
6379
6380
6381
6382
6383
6384
6385
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6378

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



6397
6398
6399
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6397

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



6388
6389
6390
6391
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6388

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

.hourObject



6401
6402
6403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6401

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

.minuteObject



6405
6406
6407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6405

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

Instance Method Details

#to_hashObject



6409
6410
6411
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6409

def to_hash
  value
end