Class: GolfSwitch::CourseInfo

Inherits:
Request
  • Object
show all
Defined in:
lib/golf_switch/course_info.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(course_id) ⇒ CourseInfo

Returns a new instance of CourseInfo.



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

def initialize(course_id)
  @course_id = course_id
end

Instance Attribute Details

#api_responseObject

Returns the value of attribute api_response.



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

def api_response
  @api_response
end

#course_idObject

Returns the value of attribute course_id.



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

def course_id
  @course_id
end

Instance Method Details

#commitObject



17
18
19
# File 'lib/golf_switch/course_info.rb', line 17

def commit
  super("course_info")
end

#get_optionsObject



9
10
11
12
13
14
15
# File 'lib/golf_switch/course_info.rb', line 9

def get_options
  {
    "Req"=>{
      "CourseId"=>@course_id
    }
  }
end

#parse_errorObject



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

def parse_error
  @response[:course_info_response][:course_info_result]
end

#parse_responseObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/golf_switch/course_info.rb', line 25

def parse_response
  begin
    unless error?
      @api_response = CourseInfoCourse.parse_course(@response[:course_info_response][:course_info_result])
    else
      puts "Error #{error_message}"
    end
  rescue
    puts "Error On Parsing Response"
  end
end