Class: Asdawqw::Yield

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/myield.rb

Overview

Yield Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(begin_date = nil, end_date = nil, amount = nil, modifier = nil, weekend_param = nil, param = nil) ⇒ Yield

Returns a new instance of Yield.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/asdawqw/models/myield.rb', line 49

def initialize(begin_date = nil,
               end_date = nil,
               amount = nil,
               modifier = nil,
               weekend_param = nil,
               param = nil)
  @begin_date = begin_date
  @end_date = end_date
  @amount = amount
  @modifier = modifier
  @weekend_param = weekend_param
  @param = param
end

Instance Attribute Details

#amountFloat

Yield amount

Returns:

  • (Float)


19
20
21
# File 'lib/asdawqw/models/myield.rb', line 19

def amount
  @amount
end

#begin_dateDate

From date. Date should be in format “yyyy-MM-dd”

Returns:

  • (Date)


11
12
13
# File 'lib/asdawqw/models/myield.rb', line 11

def begin_date
  @begin_date
end

#end_dateDate

To date. Date should be in format “yyyy-MM-dd”

Returns:

  • (Date)


15
16
17
# File 'lib/asdawqw/models/myield.rb', line 15

def end_date
  @end_date
end

#modifierYieldModifierEnum

Type of change DECREASE_PERCENT, INCREASE_AMOUNT, DECREASE_AMOUNT

Returns:



24
25
26
# File 'lib/asdawqw/models/myield.rb', line 24

def modifier
  @modifier
end

#paramInteger

Parameter. It can verify depending on what YMR was set. More details about params you can see in the description above.

Returns:

  • (Integer)


35
36
37
# File 'lib/asdawqw/models/myield.rb', line 35

def param
  @param
end

#weekend_paramWeekendParamEnum

Weekend enum type DAYS_OF_WEEKEND_FRI_SAT, DAYS_OF_WEEKEND_FRI_SAT_SUN, DAYS_OF_WEEKEND_THU_FRI_SAT, DAYS_OF_WEEKEND_THU_FRI_SAT_SUN

Returns:



30
31
32
# File 'lib/asdawqw/models/myield.rb', line 30

def weekend_param
  @weekend_param
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/asdawqw/models/myield.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  begin_date = hash['beginDate']
  end_date = hash['endDate']
  amount = hash['amount']
  modifier = hash['modifier']
  weekend_param = hash['weekendParam']
  param = hash['param']

  # Create object from extracted values.
  Yield.new(begin_date,
            end_date,
            amount,
            modifier,
            weekend_param,
            param)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/asdawqw/models/myield.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['begin_date'] = 'beginDate'
  @_hash['end_date'] = 'endDate'
  @_hash['amount'] = 'amount'
  @_hash['modifier'] = 'modifier'
  @_hash['weekend_param'] = 'weekendParam'
  @_hash['param'] = 'param'
  @_hash
end