hostconnect 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. data/CHANGELOG +8 -0
  2. data/MIT-LICENSE +22 -0
  3. data/README.markdown +16 -0
  4. data/Rakefile +48 -0
  5. data/hostconnect.gemspec +44 -0
  6. data/lib/hostconnect/builder.rb +50 -0
  7. data/lib/hostconnect/builders/add_service_builder.rb +60 -0
  8. data/lib/hostconnect/builders/agent_info_builder.rb +19 -0
  9. data/lib/hostconnect/builders/get_booking_builder.rb +24 -0
  10. data/lib/hostconnect/builders/get_booking_payment_summary_builder.rb +20 -0
  11. data/lib/hostconnect/builders/get_locations_builder.rb +18 -0
  12. data/lib/hostconnect/builders/get_services_builder.rb +18 -0
  13. data/lib/hostconnect/builders/get_system_settings_builder.rb +18 -0
  14. data/lib/hostconnect/builders/list_bookings_builder.rb +27 -0
  15. data/lib/hostconnect/builders/new_booking_info_builder.rb +23 -0
  16. data/lib/hostconnect/builders/option_info_builder.rb +49 -0
  17. data/lib/hostconnect/builders/pax_details_builder.rb +21 -0
  18. data/lib/hostconnect/builders/ping_builder.rb +11 -0
  19. data/lib/hostconnect/builders/record_booking_payment_builder.rb +25 -0
  20. data/lib/hostconnect/builders/room_config_builder.rb +25 -0
  21. data/lib/hostconnect/builders/service_line_note_builder.rb +17 -0
  22. data/lib/hostconnect/builders/suppler_info_builder.rb +27 -0
  23. data/lib/hostconnect/client.rb +32 -0
  24. data/lib/hostconnect/coercion.rb +50 -0
  25. data/lib/hostconnect/core_extensions/string.rb +18 -0
  26. data/lib/hostconnect/core_extensions/symbol.rb +9 -0
  27. data/lib/hostconnect/response.rb +119 -0
  28. data/lib/hostconnect/responses/add_service.rb +4 -0
  29. data/lib/hostconnect/responses/agent_info.rb +7 -0
  30. data/lib/hostconnect/responses/get_booking.rb +20 -0
  31. data/lib/hostconnect/responses/get_booking_payment_summary.rb +21 -0
  32. data/lib/hostconnect/responses/get_locations.rb +21 -0
  33. data/lib/hostconnect/responses/get_services.rb +21 -0
  34. data/lib/hostconnect/responses/get_system_settings.rb +24 -0
  35. data/lib/hostconnect/responses/list_bookings.rb +14 -0
  36. data/lib/hostconnect/responses/option_info.rb +60 -0
  37. data/lib/hostconnect/responses/ping.rb +7 -0
  38. data/lib/hostconnect/responses/record_booking_payment.rb +4 -0
  39. data/lib/hostconnect/responses/supplier_info.rb +31 -0
  40. data/lib/hostconnect/rtf_document.rb +19 -0
  41. data/lib/hostconnect/translation.rb +22 -0
  42. data/lib/hostconnect.rb +58 -0
  43. data/spec/builders/add_service_builder_spec.rb +36 -0
  44. data/spec/builders/agent_info_builder_spec.rb +13 -0
  45. data/spec/builders/get_locations_builder_spec.rb +13 -0
  46. data/spec/builders/new_booking_info_builder_spec.rb +34 -0
  47. data/spec/builders/option_info_builder_spec.rb +48 -0
  48. data/spec/builders/pax_details_builder_spec.rb +41 -0
  49. data/spec/builders/ping_builder_spec.rb +23 -0
  50. data/spec/builders/room_config_builder_spec.rb +60 -0
  51. data/spec/client_spec.rb +20 -0
  52. data/spec/coercion_spec.rb +85 -0
  53. data/spec/core_extensions_spec.rb +17 -0
  54. data/spec/fixtures/requests/add_service_request/hotel_booking.xml +42 -0
  55. data/spec/fixtures/requests/agent_info.xml +8 -0
  56. data/spec/fixtures/requests/get_locations.xml +8 -0
  57. data/spec/fixtures/requests/option_info/hotel_search.xml +11 -0
  58. data/spec/fixtures/requests/option_info/hotel_search_total_stay_price.xml +18 -0
  59. data/spec/fixtures/requests/option_info/option_number.xml +10 -0
  60. data/spec/fixtures/requests/ping.xml +5 -0
  61. data/spec/fixtures/responses/add_service.xml +11 -0
  62. data/spec/fixtures/responses/agent_info.xml +12 -0
  63. data/spec/fixtures/responses/agent_info_error.xml +7 -0
  64. data/spec/fixtures/responses/get_booking.xml +40 -0
  65. data/spec/fixtures/responses/get_locations.xml +48 -0
  66. data/spec/fixtures/responses/get_system_settings.xml +28 -0
  67. data/spec/fixtures/responses/option_info/hotel_price.xml +17 -0
  68. data/spec/fixtures/responses/option_info/hotel_search.xml +721 -0
  69. data/spec/fixtures/responses/option_info/hotel_search_with_stay_price.xml +470 -0
  70. data/spec/fixtures/responses/option_info/option_number.xml +14 -0
  71. data/spec/fixtures/responses/option_info/tours.xml +74 -0
  72. data/spec/fixtures/responses/ping.xml +8 -0
  73. data/spec/responses/add_service_spec.rb +13 -0
  74. data/spec/responses/agent_info_spec.rb +24 -0
  75. data/spec/responses/get_booking_spec.rb +33 -0
  76. data/spec/responses/get_locations_spec.rb +29 -0
  77. data/spec/responses/get_system_settings_spec.rb +21 -0
  78. data/spec/responses/option_info_spec.rb +48 -0
  79. data/spec/responses/ping_spec.rb +22 -0
  80. data/spec/spec_helper.rb +13 -0
  81. data/spec/translation_spec.rb +18 -0
  82. metadata +259 -0
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe HostConnect::GetSystemSettings do
4
+ before(:each) do
5
+ response = File.read("./spec/fixtures/responses/get_system_settings.xml")
6
+ @system_settings = GetSystemSettings.new(response)
7
+ end
8
+
9
+ it "should return an object with attributes set from the response" do
10
+ @system_settings.quotes_enabled.should be_false
11
+ @system_settings.quotes_are_default.should be_false
12
+ @system_settings.is_agent_dialogue_enabled.should be_false
13
+ end
14
+
15
+ it "should include an array with countries and destinations" do
16
+ @system_settings.countries.size.should == 1
17
+ @system_settings.countries[0].country_name.should == "(Unspecified)"
18
+ @system_settings.countries[0].destination_names.size.should == 10
19
+ @system_settings.countries[0].destination_names[0].destination_name.should == "Abu Dhabi"
20
+ end
21
+ end
@@ -0,0 +1,48 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe HostConnect::OptionInfo do
4
+ it "should have means for displaying number of hits from a hotel search" do
5
+ @response = File.read("./spec/fixtures/responses/option_info/hotel_search.xml")
6
+ option_info = OptionInfo.new(@response)
7
+ option_info.size.should == 9
8
+ end
9
+
10
+ it "should be possible to display the last element" do
11
+ @response = File.read("./spec/fixtures/responses/option_info/hotel_search.xml")
12
+ option_info = OptionInfo.new(@response)
13
+ last = option_info.last
14
+ last.opt.should == "LONACCUMLONSTDBCB"
15
+ end
16
+
17
+ it "should be possible to display the first element" do
18
+ @response = File.read("./spec/fixtures/responses/option_info/hotel_search.xml")
19
+ option_info = OptionInfo.new(@response)
20
+ first = option_info.first
21
+ first.opt.should == "LONACHOINKCSTDBEB"
22
+ end
23
+
24
+ it "should be possible to read stay results" do
25
+ @response = File.read("./spec/fixtures/responses/option_info/hotel_price.xml")
26
+ option_info = OptionInfo.new(@response).first
27
+ option_info.opt.should == "BERACBERGRABB"
28
+ option_info.option_number.should == 4772
29
+ option_info.stay_results.availability.should == "RQ"
30
+ option_info.stay_results.currency.should == "EUR"
31
+ option_info.stay_results.total_price.should == 348
32
+ end
33
+
34
+ it "should be possible to read rates" do
35
+ @response = File.read("./spec/fixtures/responses/option_info/hotel_search.xml")
36
+ option_info = OptionInfo.new(@response).first
37
+ option_info.rates.currency.should == "GBP"
38
+ option_info.rates.rate.room_rates.single_rate.should == 120
39
+ end
40
+
41
+ it "should be possible to read general info" do
42
+ @response = File.read("./spec/fixtures/responses/option_info/tours.xml")
43
+ option_info = OptionInfo.new(@response).first
44
+ option_info.general.comment.should == "Cat2/Start Oslo"
45
+ option_info.general.description.should == "Norway in a Nutshell"
46
+ option_info.general.periods.should == 5
47
+ end
48
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe HostConnect::Ping do
4
+ before(:each) do
5
+ @response = File.read("./spec/fixtures/responses/ping.xml")
6
+ end
7
+
8
+ it "should return a ping object with attributes set from the response" do
9
+ ping = Ping.new(@response)
10
+ ping.version.should == "2.05.048"
11
+ ping.backend.should == "iS"
12
+ end
13
+
14
+ it "should blow up when accessed like a collection" do
15
+ ping = Ping.new(@response)
16
+ lambda { ping.first }.should raise_error
17
+ end
18
+
19
+ it "should have a string representation" do
20
+ Ping.new(@response).to_s.should == "iS 2.05.048"
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'pp'
3
+ require 'spec'
4
+
5
+ require "./lib/hostconnect.rb"
6
+ include HostConnect
7
+
8
+ HostConnect.setup(:test, {
9
+ :version => "2_05_300",
10
+ :host => "127.0.0.1",
11
+ :path => "/",
12
+ :port => 80
13
+ })
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe HostConnect::Translation do
4
+ it "should know about room types" do
5
+ Translation.translate("Single").should == "SG"
6
+ Translation.translate("Twin").should == "TW"
7
+ Translation.translate("Double").should == "DB"
8
+ Translation.translate("Triple").should == "TR"
9
+ Translation.translate("Quad").should == "QD"
10
+ Translation.translate("Twinn").should == nil
11
+
12
+ Translation.translate("SG").should == "Single"
13
+ Translation.translate("TW").should == "Twin"
14
+ Translation.translate("DB").should == "Double"
15
+ Translation.translate("TR").should == "Triple"
16
+ Translation.translate("QD").should == "Quad"
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,259 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hostconnect
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 7
10
+ version: 0.1.7
11
+ platform: ruby
12
+ authors:
13
+ - "Bj\xC3\xB8rn Arild M\xC3\xA6land"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2008-12-02 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activesupport
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: hpricot
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: builder
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: rtf
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: echoe
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
91
+ description: Library for interfacing with Tourplan's hostConnect software, which is a web service interface for tour booking.
92
+ email: bjorn.maeland@gmail.com
93
+ executables: []
94
+
95
+ extensions: []
96
+
97
+ extra_rdoc_files:
98
+ - README.markdown
99
+ - CHANGELOG
100
+ - lib/hostconnect.rb
101
+ - lib/hostconnect/builders/agent_info_builder.rb
102
+ - lib/hostconnect/builders/pax_details_builder.rb
103
+ - lib/hostconnect/builders/record_booking_payment_builder.rb
104
+ - lib/hostconnect/builders/add_service_builder.rb
105
+ - lib/hostconnect/builders/room_config_builder.rb
106
+ - lib/hostconnect/builders/get_booking_builder.rb
107
+ - lib/hostconnect/builders/get_services_builder.rb
108
+ - lib/hostconnect/builders/get_system_settings_builder.rb
109
+ - lib/hostconnect/builders/get_locations_builder.rb
110
+ - lib/hostconnect/builders/new_booking_info_builder.rb
111
+ - lib/hostconnect/builders/suppler_info_builder.rb
112
+ - lib/hostconnect/builders/list_bookings_builder.rb
113
+ - lib/hostconnect/builders/option_info_builder.rb
114
+ - lib/hostconnect/builders/get_booking_payment_summary_builder.rb
115
+ - lib/hostconnect/builders/service_line_note_builder.rb
116
+ - lib/hostconnect/builders/ping_builder.rb
117
+ - lib/hostconnect/coercion.rb
118
+ - lib/hostconnect/core_extensions/string.rb
119
+ - lib/hostconnect/core_extensions/symbol.rb
120
+ - lib/hostconnect/translation.rb
121
+ - lib/hostconnect/responses/agent_info.rb
122
+ - lib/hostconnect/responses/get_services.rb
123
+ - lib/hostconnect/responses/list_bookings.rb
124
+ - lib/hostconnect/responses/get_locations.rb
125
+ - lib/hostconnect/responses/get_booking.rb
126
+ - lib/hostconnect/responses/record_booking_payment.rb
127
+ - lib/hostconnect/responses/option_info.rb
128
+ - lib/hostconnect/responses/get_booking_payment_summary.rb
129
+ - lib/hostconnect/responses/add_service.rb
130
+ - lib/hostconnect/responses/supplier_info.rb
131
+ - lib/hostconnect/responses/get_system_settings.rb
132
+ - lib/hostconnect/responses/ping.rb
133
+ - lib/hostconnect/rtf_document.rb
134
+ - lib/hostconnect/builder.rb
135
+ - lib/hostconnect/client.rb
136
+ - lib/hostconnect/response.rb
137
+ files:
138
+ - Rakefile
139
+ - README.markdown
140
+ - CHANGELOG
141
+ - hostconnect.gemspec
142
+ - lib/hostconnect.rb
143
+ - lib/hostconnect/builders/agent_info_builder.rb
144
+ - lib/hostconnect/builders/pax_details_builder.rb
145
+ - lib/hostconnect/builders/record_booking_payment_builder.rb
146
+ - lib/hostconnect/builders/add_service_builder.rb
147
+ - lib/hostconnect/builders/room_config_builder.rb
148
+ - lib/hostconnect/builders/get_booking_builder.rb
149
+ - lib/hostconnect/builders/get_services_builder.rb
150
+ - lib/hostconnect/builders/get_system_settings_builder.rb
151
+ - lib/hostconnect/builders/get_locations_builder.rb
152
+ - lib/hostconnect/builders/new_booking_info_builder.rb
153
+ - lib/hostconnect/builders/suppler_info_builder.rb
154
+ - lib/hostconnect/builders/list_bookings_builder.rb
155
+ - lib/hostconnect/builders/option_info_builder.rb
156
+ - lib/hostconnect/builders/get_booking_payment_summary_builder.rb
157
+ - lib/hostconnect/builders/service_line_note_builder.rb
158
+ - lib/hostconnect/builders/ping_builder.rb
159
+ - lib/hostconnect/coercion.rb
160
+ - lib/hostconnect/core_extensions/string.rb
161
+ - lib/hostconnect/core_extensions/symbol.rb
162
+ - lib/hostconnect/translation.rb
163
+ - lib/hostconnect/responses/agent_info.rb
164
+ - lib/hostconnect/responses/get_services.rb
165
+ - lib/hostconnect/responses/list_bookings.rb
166
+ - lib/hostconnect/responses/get_locations.rb
167
+ - lib/hostconnect/responses/get_booking.rb
168
+ - lib/hostconnect/responses/record_booking_payment.rb
169
+ - lib/hostconnect/responses/option_info.rb
170
+ - lib/hostconnect/responses/get_booking_payment_summary.rb
171
+ - lib/hostconnect/responses/add_service.rb
172
+ - lib/hostconnect/responses/supplier_info.rb
173
+ - lib/hostconnect/responses/get_system_settings.rb
174
+ - lib/hostconnect/responses/ping.rb
175
+ - lib/hostconnect/rtf_document.rb
176
+ - lib/hostconnect/builder.rb
177
+ - lib/hostconnect/client.rb
178
+ - lib/hostconnect/response.rb
179
+ - MIT-LICENSE
180
+ - spec/builders/new_booking_info_builder_spec.rb
181
+ - spec/builders/ping_builder_spec.rb
182
+ - spec/builders/get_locations_builder_spec.rb
183
+ - spec/builders/add_service_builder_spec.rb
184
+ - spec/builders/room_config_builder_spec.rb
185
+ - spec/builders/option_info_builder_spec.rb
186
+ - spec/builders/agent_info_builder_spec.rb
187
+ - spec/builders/pax_details_builder_spec.rb
188
+ - spec/spec_helper.rb
189
+ - spec/fixtures/requests/ping.xml
190
+ - spec/fixtures/requests/agent_info.xml
191
+ - spec/fixtures/requests/option_info/hotel_search_total_stay_price.xml
192
+ - spec/fixtures/requests/option_info/option_number.xml
193
+ - spec/fixtures/requests/option_info/hotel_search.xml
194
+ - spec/fixtures/requests/get_locations.xml
195
+ - spec/fixtures/requests/add_service_request/hotel_booking.xml
196
+ - spec/fixtures/responses/ping.xml
197
+ - spec/fixtures/responses/agent_info.xml
198
+ - spec/fixtures/responses/agent_info_error.xml
199
+ - spec/fixtures/responses/get_booking.xml
200
+ - spec/fixtures/responses/option_info/tours.xml
201
+ - spec/fixtures/responses/option_info/hotel_search_with_stay_price.xml
202
+ - spec/fixtures/responses/option_info/option_number.xml
203
+ - spec/fixtures/responses/option_info/hotel_price.xml
204
+ - spec/fixtures/responses/option_info/hotel_search.xml
205
+ - spec/fixtures/responses/get_system_settings.xml
206
+ - spec/fixtures/responses/add_service.xml
207
+ - spec/fixtures/responses/get_locations.xml
208
+ - spec/client_spec.rb
209
+ - spec/core_extensions_spec.rb
210
+ - spec/responses/get_booking_spec.rb
211
+ - spec/responses/get_system_settings_spec.rb
212
+ - spec/responses/agent_info_spec.rb
213
+ - spec/responses/option_info_spec.rb
214
+ - spec/responses/add_service_spec.rb
215
+ - spec/responses/ping_spec.rb
216
+ - spec/responses/get_locations_spec.rb
217
+ - spec/translation_spec.rb
218
+ - spec/coercion_spec.rb
219
+ has_rdoc: true
220
+ homepage: http://www.github.com/bmaland/hostconnect/
221
+ licenses: []
222
+
223
+ post_install_message:
224
+ rdoc_options:
225
+ - --line-numbers
226
+ - --inline-source
227
+ - --title
228
+ - Hostconnect
229
+ - --main
230
+ - README.markdown
231
+ require_paths:
232
+ - lib
233
+ required_ruby_version: !ruby/object:Gem::Requirement
234
+ none: false
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ hash: 3
239
+ segments:
240
+ - 0
241
+ version: "0"
242
+ required_rubygems_version: !ruby/object:Gem::Requirement
243
+ none: false
244
+ requirements:
245
+ - - ">="
246
+ - !ruby/object:Gem::Version
247
+ hash: 3
248
+ segments:
249
+ - 0
250
+ version: "0"
251
+ requirements: []
252
+
253
+ rubyforge_project: hostconnect
254
+ rubygems_version: 1.3.7
255
+ signing_key:
256
+ specification_version: 2
257
+ summary: Library for interfacing with Tourplan's hostConnect software, which is a web service interface for tour booking.
258
+ test_files: []
259
+