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.



16466
16467
16468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16466

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16464
16465
16466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16464

def value
  @value
end

Class Method Details

.ALLObject



16486
16487
16488
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16486

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



16471
16472
16473
16474
16475
16476
16477
16478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16471

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



16502
16503
16504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16502

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



16481
16482
16483
16484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16481

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

.hourObject



16506
16507
16508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16506

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

.minuteObject



16510
16511
16512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16510

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

.monthObject



16494
16495
16496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16494

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

.weekObject



16498
16499
16500
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16498

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

.yearObject



16490
16491
16492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16490

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

Instance Method Details

#to_hashObject



16514
16515
16516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16514

def to_hash
  value
end