Class: Rezgo::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rezgo/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(transcode, api_key, result_type = "raw") ⇒ Connection

Returns a new instance of Connection.

Raises:

  • (ArgumentError)


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

#aboutObject



21
22
23
# File 'lib/rezgo/connection.rb', line 21

def about
  request("about")
end

#classification_listObject



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

#companyObject



13
14
15
# File 'lib/rezgo/connection.rb', line 13

def company
  request("company")
end

#headersObject



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_listObject



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

#tagsObject



29
30
31
# File 'lib/rezgo/connection.rb', line 29

def tags
  request("tags")
end