Class: GolfSwitch::BookGolf
- Defined in:
- lib/golf_switch/book_golf.rb
Instance Attribute Summary collapse
-
#api_response ⇒ Object
Returns the value of attribute api_response.
-
#book_golf_items ⇒ Object
Returns the value of attribute book_golf_items.
Attributes inherited from Request
#client, #config, #request, #response, #soap_error
Instance Method Summary collapse
- #commit ⇒ Object
- #get_options ⇒ Object
-
#initialize(attributes = {}) ⇒ BookGolf
constructor
A new instance of BookGolf.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(attributes = {}) ⇒ BookGolf
Returns a new instance of BookGolf.
4 5 6 |
# File 'lib/golf_switch/book_golf.rb', line 4 def initialize(attributes={}) @book_golf_items = [] end |
Instance Attribute Details
#api_response ⇒ Object
Returns the value of attribute api_response.
3 4 5 |
# File 'lib/golf_switch/book_golf.rb', line 3 def api_response @api_response end |
#book_golf_items ⇒ Object
Returns the value of attribute book_golf_items.
3 4 5 |
# File 'lib/golf_switch/book_golf.rb', line 3 def book_golf_items @book_golf_items end |
Instance Method Details
#commit ⇒ Object
20 21 22 |
# File 'lib/golf_switch/book_golf.rb', line 20 def commit super("book_golf") end |
#get_options ⇒ Object
8 9 10 11 12 13 |
# File 'lib/golf_switch/book_golf.rb', line 8 def { "Req"=>option_attributes } end |
#option_attributes ⇒ Object
14 15 16 17 18 |
# File 'lib/golf_switch/book_golf.rb', line 14 def option_attributes { "BookGolfItems"=>{"BookGolfItem"=>Array(@book_golf_items).collect{|bgi| bgi.option_attributes}} } end |
#parse_error ⇒ Object
24 25 26 |
# File 'lib/golf_switch/book_golf.rb', line 24 def parse_error @response[:book_golf_response][:book_golf_result] end |
#parse_response ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/golf_switch/book_golf.rb', line 28 def parse_response begin unless error? @api_response = GolfSwitch::GolfBook.parse_golf_books(@response[:book_golf_response][:book_golf_result]) else puts "Error #{}" end rescue puts "Parse Error On Book Golf" end end |