booking_automation 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.rspec_status +29 -27
- data/CHANGELOG.md +6 -0
- data/README.md +2 -0
- data/lib/booking_automation/version.rb +1 -1
- data/lib/booking_automation/xml_client.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58960dc4187dc30fcd6ae8df3e6267d8e2e2328114170748845f6f80bd5fe59b
|
4
|
+
data.tar.gz: edd6dd32111600ac639f1ecdb10a57682f98d99ceae870c43525715e33f53d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d5331a00d136385420963b0ffcd76783537b5080996073df7ea0b48350497988c7e6a93da38b96b6205b81f8d941408fe8af9a6851f98f921a10a24eff7957
|
7
|
+
data.tar.gz: 6dc59dc7993e5d3cd27da8a3b47f7f8fa7d60c4e5e86a409723636ca21c2e4c22e68c1f1eb718add6a3ed7cbcfbb8e5ea0e7f1cf5fe65a82ef9a18e48593c5f5
|
data/.rspec_status
CHANGED
@@ -1,31 +1,33 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
-------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/booking_automation_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/hash_spec.rb[1:1:1] | passed | 0.
|
5
|
-
./spec/hash_spec.rb[1:1:2] | passed | 0.
|
6
|
-
./spec/hash_spec.rb[1:1:3] | passed | 0.
|
7
|
-
./spec/hash_spec.rb[1:1:4] | passed | 0.
|
8
|
-
./spec/hash_spec.rb[1:1:5] | passed | 0.
|
9
|
-
./spec/hash_spec.rb[1:1:6] | passed | 0.
|
3
|
+
./spec/booking_automation_spec.rb[1:1] | passed | 0.00034 seconds |
|
4
|
+
./spec/hash_spec.rb[1:1:1] | passed | 0.00051 seconds |
|
5
|
+
./spec/hash_spec.rb[1:1:2] | passed | 0.00124 seconds |
|
6
|
+
./spec/hash_spec.rb[1:1:3] | passed | 0.00056 seconds |
|
7
|
+
./spec/hash_spec.rb[1:1:4] | passed | 0.00125 seconds |
|
8
|
+
./spec/hash_spec.rb[1:1:5] | passed | 0.00058 seconds |
|
9
|
+
./spec/hash_spec.rb[1:1:6] | passed | 0.00051 seconds |
|
10
10
|
./spec/json_client_spec.rb[1:1:1] | passed | 0.00007 seconds |
|
11
|
-
./spec/json_client_spec.rb[1:2:1] | passed | 0.
|
11
|
+
./spec/json_client_spec.rb[1:2:1] | passed | 0.00025 seconds |
|
12
12
|
./spec/json_client_spec.rb[1:2:2] | passed | 0.00006 seconds |
|
13
|
-
./spec/json_client_spec.rb[1:3:1:1] | passed | 0.
|
14
|
-
./spec/json_client_spec.rb[1:3:2:1] | passed | 0.
|
15
|
-
./spec/json_client_spec.rb[1:4:1:1] | passed | 0.
|
16
|
-
./spec/json_client_spec.rb[1:4:2:1] | passed | 0.
|
17
|
-
./spec/json_client_spec.rb[1:5:1:1] | passed | 0.
|
18
|
-
./spec/json_client_spec.rb[1:5:2:1] | passed | 0.
|
19
|
-
./spec/xml_client_spec.rb[1:1:1] | passed | 0.
|
20
|
-
./spec/xml_client_spec.rb[1:2:1:1] | passed | 0.
|
21
|
-
./spec/xml_client_spec.rb[1:2:1:2] | passed | 0.
|
22
|
-
./spec/xml_client_spec.rb[1:2:2:1] | passed | 0.
|
23
|
-
./spec/xml_client_spec.rb[1:2:2:2] | passed | 0.
|
24
|
-
./spec/xml_client_spec.rb[1:3:1:1:1:1] | passed | 0.
|
25
|
-
./spec/xml_client_spec.rb[1:3:1:2:1] | passed | 0.
|
26
|
-
./spec/xml_client_spec.rb[1:3:2:1:1:1] | passed | 0.
|
27
|
-
./spec/xml_client_spec.rb[1:3:2:2:1] | passed | 0.
|
28
|
-
./spec/
|
29
|
-
./spec/
|
30
|
-
./spec/xml_request_spec.rb[1:
|
31
|
-
./spec/xml_request_spec.rb[1:
|
13
|
+
./spec/json_client_spec.rb[1:3:1:1] | passed | 0.00763 seconds |
|
14
|
+
./spec/json_client_spec.rb[1:3:2:1] | passed | 0.0021 seconds |
|
15
|
+
./spec/json_client_spec.rb[1:4:1:1] | passed | 0.00164 seconds |
|
16
|
+
./spec/json_client_spec.rb[1:4:2:1] | passed | 0.00084 seconds |
|
17
|
+
./spec/json_client_spec.rb[1:5:1:1] | passed | 0.0013 seconds |
|
18
|
+
./spec/json_client_spec.rb[1:5:2:1] | passed | 0.00503 seconds |
|
19
|
+
./spec/xml_client_spec.rb[1:1:1] | passed | 0.00041 seconds |
|
20
|
+
./spec/xml_client_spec.rb[1:2:1:1] | passed | 0.00031 seconds |
|
21
|
+
./spec/xml_client_spec.rb[1:2:1:2] | passed | 0.00019 seconds |
|
22
|
+
./spec/xml_client_spec.rb[1:2:2:1] | passed | 0.00011 seconds |
|
23
|
+
./spec/xml_client_spec.rb[1:2:2:2] | passed | 0.00009 seconds |
|
24
|
+
./spec/xml_client_spec.rb[1:3:1:1:1:1] | passed | 0.00249 seconds |
|
25
|
+
./spec/xml_client_spec.rb[1:3:1:2:1] | passed | 0.00171 seconds |
|
26
|
+
./spec/xml_client_spec.rb[1:3:2:1:1:1] | passed | 0.00138 seconds |
|
27
|
+
./spec/xml_client_spec.rb[1:3:2:2:1] | passed | 0.00179 seconds |
|
28
|
+
./spec/xml_client_spec.rb[1:3:3:1:1:1] | passed | 0.00331 seconds |
|
29
|
+
./spec/xml_client_spec.rb[1:3:3:2:1] | passed | 0.00326 seconds |
|
30
|
+
./spec/xml_request_spec.rb[1:1:1] | passed | 0.00022 seconds |
|
31
|
+
./spec/xml_request_spec.rb[1:1:2] | passed | 0.00018 seconds |
|
32
|
+
./spec/xml_request_spec.rb[1:2:1] | passed | 0.00016 seconds |
|
33
|
+
./spec/xml_request_spec.rb[1:2:2] | passed | 0.00014 seconds |
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,8 @@ client.get_properties(propid: 123) # Display individual property data
|
|
54
54
|
|
55
55
|
client.get_bookings() # Get all bookings
|
56
56
|
client.get_bookings(propid: 123, datefrom: '20190101') # Pass parameters as per docs
|
57
|
+
|
58
|
+
client.modify_booking(123, guestFirstName: 'John') # Updates by id with given params
|
57
59
|
```
|
58
60
|
|
59
61
|
Data returned is already parsed in a meaningful way to plain Ruby `Hash`.
|
@@ -26,6 +26,13 @@ module BookingAutomation
|
|
26
26
|
e.response
|
27
27
|
end
|
28
28
|
|
29
|
+
def modify_booking(id, attrs = {})
|
30
|
+
response = self.class.post('/putBookings', body: modify_payload(id, attrs))
|
31
|
+
parse! response
|
32
|
+
rescue APIError => e
|
33
|
+
e.response
|
34
|
+
end
|
35
|
+
|
29
36
|
private
|
30
37
|
|
31
38
|
def parse!(response)
|
@@ -44,5 +51,18 @@ module BookingAutomation
|
|
44
51
|
def xmlize(opts = {})
|
45
52
|
XMLRequest.new(auth, opts).to_xml
|
46
53
|
end
|
54
|
+
|
55
|
+
def modify_payload(id, attrs = {})
|
56
|
+
payload = Nokogiri::XML(xmlize())
|
57
|
+
Nokogiri::XML::Builder.with(payload.at('request')) do |xml|
|
58
|
+
xml.bookings do
|
59
|
+
xml.booking(id: id, action: 'modify') do
|
60
|
+
attrs.each do |prop, value|
|
61
|
+
xml.public_send prop, value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end.doc.root.to_xml
|
66
|
+
end
|
47
67
|
end
|
48
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booking_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Babin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|