Class: GolfSwitch::AltRateType

Inherits:
Object
  • Object
show all
Defined in:
lib/golf_switch/alt_rate_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AltRateType

Returns a new instance of AltRateType.



5
6
7
8
9
10
11
12
13
# File 'lib/golf_switch/alt_rate_type.rb', line 5

def initialize(attributes={})
  attributes.each do |name, value|
    begin
      send("#{name}=", value)
    rescue
      puts "Add #{name} to accessor in alt rate type"
    end
  end
end

Instance Attribute Details

#descObject

Returns the value of attribute desc.



3
4
5
# File 'lib/golf_switch/alt_rate_type.rb', line 3

def desc
  @desc
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/golf_switch/alt_rate_type.rb', line 3

def id
  @id
end

#nmObject

Returns the value of attribute nm.



3
4
5
# File 'lib/golf_switch/alt_rate_type.rb', line 3

def nm
  @nm
end

Class Method Details

.patse_alt_rate_types(response) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/golf_switch/alt_rate_type.rb', line 15

def self.patse_alt_rate_types(response)
  alt_rate_types = []
  if response[:alt_rate_types].is_a?(Array)
    response[:alt_rate_types].each do |alt_rate_type|
      alt_rate_types << GolfSwitch::AltRateType.new(alt_rate_types)
    end
  elsif response[:alt_rate_types].is_a?(Hash)
    alt_rate_types << GolfSwitch::AltRateType.new(response[:alt_rate_types])
  end
  alt_rate_types
end