Class: Rezgo::Connection
- Inherits:
-
Object
- Object
- Rezgo::Connection
- Defined in:
- lib/rezgo/connection.rb
Instance Method Summary collapse
- #about ⇒ Object
- #classification_list ⇒ Object
- #commit(opt_args = {}) ⇒ Object
- #company ⇒ Object
- #headers ⇒ Object
-
#initialize(transcode, api_key, result_type = "raw") ⇒ Connection
constructor
A new instance of Connection.
- #modify_bookings(cancel_code, voucher_code) ⇒ Object
- #month(uid, opt_args = {}) ⇒ Object
- #region_list ⇒ Object
- #search_bookings(transaction_code) ⇒ Object
- #search_items(opt_args = {}) ⇒ Object
- #tags ⇒ Object
Constructor Details
#initialize(transcode, api_key, result_type = "raw") ⇒ Connection
Returns a new instance of Connection.
3 4 5 6 7 8 9 10 11 |
# File 'lib/rezgo/connection.rb', line 3 def initialize(transcode, api_key, result_type = "raw") raise ArgumentError, "Invalid Transcode" unless transcode.downcase.start_with?("p") raise ArgumentError, "Invalid API Key" unless api_key.match(/[a-zA-Z0-9]{3}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{3}/i) @transcode = transcode @api_key = api_key @result_type = result_type @base_url = "https://xml.rezgo.com/xml?" end |
Instance Method Details
#about ⇒ Object
21 22 23 |
# File 'lib/rezgo/connection.rb', line 21 def about request("about") end |
#classification_list ⇒ Object
53 54 55 |
# File 'lib/rezgo/connection.rb', line 53 def classification_list request("classification_list") end |
#commit(opt_args = {}) ⇒ Object
33 34 35 |
# File 'lib/rezgo/connection.rb', line 33 def commit(opt_args = {}) request("commit", opt_args) end |
#company ⇒ Object
13 14 15 |
# File 'lib/rezgo/connection.rb', line 13 def company request("company") end |
#headers ⇒ Object
17 18 19 |
# File 'lib/rezgo/connection.rb', line 17 def headers request("headers") end |
#modify_bookings(cancel_code, voucher_code) ⇒ Object
37 38 39 |
# File 'lib/rezgo/connection.rb', line 37 def modify_bookings(cancel_code, voucher_code) request("modify_bookings", {:a => "cancel", :cancel_code => cancel_code, :q => voucher_code}) end |
#month(uid, opt_args = {}) ⇒ Object
45 46 47 |
# File 'lib/rezgo/connection.rb', line 45 def month(uid, opt_args = {}) request("month", opt_args.merge(:q => uid)) end |
#region_list ⇒ Object
49 50 51 |
# File 'lib/rezgo/connection.rb', line 49 def region_list request("region_list") end |
#search_bookings(transaction_code) ⇒ Object
41 42 43 |
# File 'lib/rezgo/connection.rb', line 41 def search_bookings(transaction_code) request("search_bookings", {:q => transaction_code}) end |
#search_items(opt_args = {}) ⇒ Object
25 26 27 |
# File 'lib/rezgo/connection.rb', line 25 def search_items(opt_args = {}) request("search_items", opt_args) end |
#tags ⇒ Object
29 30 31 |
# File 'lib/rezgo/connection.rb', line 29 def request("tags") end |