Class: GolfSwitch::GetAltRateType

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

Instance Attribute Summary collapse

Attributes inherited from Request

#client, #config, #request, #response, #soap_error

Instance Method Summary collapse

Methods inherited from Request

#error?, #error_message, #get_authentication_header

Constructor Details

#initialize(alt_rate_type_id) ⇒ GetAltRateType

Returns a new instance of GetAltRateType.



5
6
7
# File 'lib/golf_switch/get_alt_rate_type.rb', line 5

def initialize(alt_rate_type_id)
  @alt_rate_type_id = alt_rate_type_id
end

Instance Attribute Details

#alt_rate_type_idObject

Returns the value of attribute alt_rate_type_id.



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

def alt_rate_type_id
  @alt_rate_type_id
end

Instance Method Details

#commitObject



21
22
23
# File 'lib/golf_switch/get_alt_rate_type.rb', line 21

def commit
  super("get_alt_rate_types")
end

#get_optionsObject



9
10
11
12
13
# File 'lib/golf_switch/get_alt_rate_type.rb', line 9

def get_options
  {
    "Req"=>option_attributes
  }
end

#option_attributesObject



15
16
17
18
19
# File 'lib/golf_switch/get_alt_rate_type.rb', line 15

def option_attributes
  {
    "AltRateTypeId"=>@alt_rate_type_id
  }
end

#parse_errorObject



25
26
27
# File 'lib/golf_switch/get_alt_rate_type.rb', line 25

def parse_error
  @response[:GetAltRateTypesResponse][:get_alt_rate_types_result]
end

#parse_responseObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/golf_switch/get_alt_rate_type.rb', line 29

def parse_response
  begin
    unless error?
      @api_response = GolfSwitch::GolfBook.parse_golf_books(@response[:book_golf_response][:book_golf_result])
    else
      puts "Error #{error_message}"
    end
  rescue
    puts "Parse Error On Alt Rare type"
  end
end