bookingsync-api 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e4a004b57fe3bafb9eb996e3533c0f080855e77
4
- data.tar.gz: 39e4cd40b861d00d95159dc542947546d81212ee
3
+ metadata.gz: 8191b75789179d2fad537f87145aec7c0e22c527
4
+ data.tar.gz: 1490a2be5684c26737664421e696bf462874d056
5
5
  SHA512:
6
- metadata.gz: c3e6305dc7f1cdd298af7aeb8e9634fb4bacb0e2912071f9f6cba4d390e8b2ba6af624f610c6fa02340f35795ef6129b3d87e1b51696da33d511fb7a084e02df
7
- data.tar.gz: a53f20e6310b8a88c38a21652671a85981391a94ddde1f5b6335f76d1d4442360bd6a07166bf5a363e3987aa703b8b09a13e0bb5c528c990e60fcf27abb12f67
6
+ metadata.gz: fa35e5d6a50650d73f1506b4c75d3a715f986b47dcdb0798920e65296892dc9a8adc0f4c44ef4d67274bd8c36b934a5667e5ae6b46af66b381f3577c656666b7
7
+ data.tar.gz: c20346d438250511b7ca6a2e374bb4b35017e42e5fcf54752c0b9c6ebdc0dc7aafe46a9e1e477c21d244ea01341de2a2053298b613fed370a134bf53ad4e9feb
@@ -2,6 +2,9 @@
2
2
 
3
3
  # master
4
4
 
5
+ ## 0.1.11 - 2018-05-18
6
+ - Added `add_attachment_to_message`.
7
+
5
8
  ## 0.1.10 - 2018-05-17
6
9
  - Added support for `attachments`.
7
10
 
@@ -46,6 +46,18 @@ module BookingSync::API
46
46
  def edit_message(message, options = {})
47
47
  put("inbox/messages/#{message}", messages: [options]).pop
48
48
  end
49
+
50
+ # Add attachment to message
51
+ # @param message [BookingSync::API::Resource|Integer] Message or ID of
52
+ # the message to which we are adding attachment
53
+ # @param options [Hash] Id of attachment to be added to message.
54
+ # @return [BookingSync::API::Resource] Message with updated links on success,
55
+ # exception is raised otherwise.
56
+ # @example
57
+ # @api.add_attachment_to_message(message, { id: 5 })
58
+ def add_attachment_to_message(message, options)
59
+ put("inbox/messages/#{message}/add_attachment", attachments: [options]).pop
60
+ end
49
61
  end
50
62
  end
51
63
  end
@@ -1,5 +1,5 @@
1
1
  module BookingSync
2
2
  module API
3
- VERSION = "0.1.10"
3
+ VERSION = "0.1.11"
4
4
  end
5
5
  end
@@ -74,4 +74,29 @@ describe BookingSync::API::Client::Messages do
74
74
  end
75
75
  end
76
76
  end
77
+
78
+ describe ".add_attachment_to_message", :vcr do
79
+ let(:attachment_to_be_added) { BookingSync::API::Resource.new(client, id: 1) }
80
+ let(:prefetched_message_id) {
81
+ find_resource("#{@casette_base_path}_messages/returns_messages.yml", "messages")[:id]
82
+ }
83
+ let(:attributes) { { id: attachment_to_be_added.id } }
84
+
85
+ it "adds attachment to given message" do
86
+ client.add_attachment_to_message(prefetched_message_id, attributes)
87
+ assert_requested :put, bs_url("inbox/messages/#{prefetched_message_id}/add_attachment"),
88
+ body: { attachments: [attributes] }.to_json
89
+ end
90
+
91
+ it "returns message with updated links" do
92
+ casette_path = "BookingSync_API_Client_Messages/_add_attachment_to_message" \
93
+ "/adds_attachment_to_given_message"
94
+ VCR.use_cassette(casette_path) do
95
+ expect { client.add_attachment_to_message(prefetched_message_id, attributes) }
96
+ .to change { client.message(prefetched_message_id)[:links][:attachments] }
97
+ .from([])
98
+ .to([attachment_to_be_added.id])
99
+ end
100
+ end
101
+ end
77
102
  end
@@ -0,0 +1,235 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bookingsync.com/api/v3/inbox/messages/1
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ User-Agent:
11
+ - BookingSync API gem v0.1.10
12
+ Accept:
13
+ - application/vnd.api+json
14
+ Content-Type:
15
+ - application/vnd.api+json
16
+ Authorization:
17
+ - Bearer <<ACCESS_TOKEN>>
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Connection:
21
+ - keep-alive
22
+ Keep-Alive:
23
+ - '30'
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Content-Type:
32
+ - application/vnd.api+json; charset=utf-8
33
+ Etag:
34
+ - W/"715149a0010636aebf4033010785bbfe"
35
+ Link:
36
+ - <https://www.bookingsync.com/api/v3/inbox/messages/1?page=1>; rel="first",
37
+ <https://www.bookingsync.com/api/v3/inbox/messages/1?page=1>; rel="last"
38
+ P3p:
39
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
40
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
41
+ Set-Cookie:
42
+ - ahoy_track=true; path=/
43
+ - ahoy_visit=89a85b24-fee9-4413-9937-99c1579aa3f8; path=/; expires=Thu, 24 May
44
+ 2018 18:09:34 -0000
45
+ - ahoy_visitor=be385529-b9c0-4d62-806b-ff6aab35a353; path=/; expires=Sun, 17
46
+ May 2020 18:09:34 -0000
47
+ Vary:
48
+ - Origin
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Current-Page:
52
+ - '1'
53
+ X-Frame-Options:
54
+ - SAMEORIGIN
55
+ X-Per-Page:
56
+ - '100'
57
+ X-Ratelimit-Limit:
58
+ - '1000'
59
+ X-Ratelimit-Remaining:
60
+ - '999'
61
+ X-Ratelimit-Reset:
62
+ - '1526583600'
63
+ X-Request-Id:
64
+ - 137cdb22-9438-4972-86e7-e6032d16c650
65
+ X-Runtime:
66
+ - '0.899569'
67
+ X-Total-Count:
68
+ - '1'
69
+ X-Total-Pages:
70
+ - '1'
71
+ X-Updated-Since-Request-Synced-At:
72
+ - 2018-05-17 18:09:34 UTC
73
+ X-Xss-Protection:
74
+ - 1; mode=block
75
+ Date:
76
+ - Thu, 17 May 2018 18:09:34 GMT
77
+ Content-Length:
78
+ - '767'
79
+ body:
80
+ encoding: UTF-8
81
+ string: '{"links":{"messages.attachments":"https://www.bookingsync.com/api/v3/inbox/attachments/{messages.attachments}","messages.conversation":"https://www.bookingsync.com/api/v3/inbox/conversations/{messages.conversation}","messages.sender":"https://www.bookingsync.com/api/v3/inbox/participants/{messages.sender}"},"messages":[{"links":{"attachments":[],"conversation":1,"sender":1},"channel":null,"content":"hey","created_at":"2018-05-17T13:50:43Z","id":1,"origin":"homeaway","sent_at":null,"updated_at":"2018-05-17T13:50:43Z","visibility":"external"}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/inbox/messages/1?page=1","last":"https://www.bookingsync.com/api/v3/inbox/messages/1?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"100"}}'
82
+ http_version:
83
+ recorded_at: Thu, 17 May 2018 18:09:34 GMT
84
+ - request:
85
+ method: put
86
+ uri: https://www.bookingsync.com/api/v3/inbox/messages/1/add_attachment
87
+ body:
88
+ encoding: UTF-8
89
+ string: '{"attachments":[{"id":1}]}'
90
+ headers:
91
+ User-Agent:
92
+ - BookingSync API gem v0.1.10
93
+ Accept:
94
+ - application/vnd.api+json
95
+ Content-Type:
96
+ - application/vnd.api+json
97
+ Authorization:
98
+ - Bearer <<ACCESS_TOKEN>>
99
+ Accept-Encoding:
100
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
101
+ Connection:
102
+ - keep-alive
103
+ Keep-Alive:
104
+ - '30'
105
+ response:
106
+ status:
107
+ code: 200
108
+ message: OK
109
+ headers:
110
+ Cache-Control:
111
+ - max-age=0, private, must-revalidate
112
+ Content-Type:
113
+ - application/vnd.api+json; charset=utf-8
114
+ Etag:
115
+ - W/"1386c92f3d7e77e46e44c41bb6187e94"
116
+ P3p:
117
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
118
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
119
+ Set-Cookie:
120
+ - ahoy_track=true; path=/
121
+ - ahoy_visit=a9eda395-e504-4a18-aab0-b1bc48e399dc; path=/; expires=Thu, 24 May
122
+ 2018 18:09:35 -0000
123
+ - ahoy_visitor=7f9af0a1-84f4-43ac-a410-55481fdc459f; path=/; expires=Sun, 17
124
+ May 2020 18:09:35 -0000
125
+ Vary:
126
+ - Origin
127
+ X-Content-Type-Options:
128
+ - nosniff
129
+ X-Frame-Options:
130
+ - SAMEORIGIN
131
+ X-Ratelimit-Limit:
132
+ - '1000'
133
+ X-Ratelimit-Remaining:
134
+ - '998'
135
+ X-Ratelimit-Reset:
136
+ - '1526583600'
137
+ X-Request-Id:
138
+ - f05bb19b-5c55-43e5-af0e-adfd6162024c
139
+ X-Runtime:
140
+ - '0.114332'
141
+ X-Updated-Since-Request-Synced-At:
142
+ - 2018-05-17 18:09:35 UTC
143
+ X-Xss-Protection:
144
+ - 1; mode=block
145
+ Date:
146
+ - Thu, 17 May 2018 18:09:35 GMT
147
+ Content-Length:
148
+ - '562'
149
+ body:
150
+ encoding: UTF-8
151
+ string: '{"links":{"messages.attachments":"https://www.bookingsync.com/api/v3/inbox/attachments/{messages.attachments}","messages.conversation":"https://www.bookingsync.com/api/v3/inbox/conversations/{messages.conversation}","messages.sender":"https://www.bookingsync.com/api/v3/inbox/participants/{messages.sender}"},"messages":[{"links":{"attachments":[1],"conversation":1,"sender":1},"channel":null,"content":"hey","created_at":"2018-05-17T13:50:43Z","id":1,"origin":"homeaway","sent_at":null,"updated_at":"2018-05-17T13:50:43Z","visibility":"external"}],"meta":{}}'
152
+ http_version:
153
+ recorded_at: Thu, 17 May 2018 18:09:35 GMT
154
+ - request:
155
+ method: get
156
+ uri: https://www.bookingsync.com/api/v3/inbox/messages/1
157
+ body:
158
+ encoding: UTF-8
159
+ string: "{}"
160
+ headers:
161
+ User-Agent:
162
+ - BookingSync API gem v0.1.10
163
+ Accept:
164
+ - application/vnd.api+json
165
+ Content-Type:
166
+ - application/vnd.api+json
167
+ Authorization:
168
+ - Bearer <<ACCESS_TOKEN>>
169
+ Accept-Encoding:
170
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
171
+ Connection:
172
+ - keep-alive
173
+ Keep-Alive:
174
+ - '30'
175
+ response:
176
+ status:
177
+ code: 200
178
+ message: OK
179
+ headers:
180
+ Cache-Control:
181
+ - max-age=0, private, must-revalidate
182
+ Content-Type:
183
+ - application/vnd.api+json; charset=utf-8
184
+ Etag:
185
+ - W/"eb30674d4fd699b7bcba4ccf5be788c3"
186
+ Link:
187
+ - <https://www.bookingsync.com/api/v3/inbox/messages/1?page=1>; rel="first",
188
+ <https://www.bookingsync.com/api/v3/inbox/messages/1?page=1>; rel="last"
189
+ P3p:
190
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
191
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
192
+ Set-Cookie:
193
+ - ahoy_track=true; path=/
194
+ - ahoy_visit=00d6c2aa-89a7-4a6f-b672-7024babafe98; path=/; expires=Thu, 24 May
195
+ 2018 18:09:35 -0000
196
+ - ahoy_visitor=48ea80b5-718e-4fa8-9d91-61155d646376; path=/; expires=Sun, 17
197
+ May 2020 18:09:35 -0000
198
+ Vary:
199
+ - Origin
200
+ X-Content-Type-Options:
201
+ - nosniff
202
+ X-Current-Page:
203
+ - '1'
204
+ X-Frame-Options:
205
+ - SAMEORIGIN
206
+ X-Per-Page:
207
+ - '100'
208
+ X-Ratelimit-Limit:
209
+ - '1000'
210
+ X-Ratelimit-Remaining:
211
+ - '997'
212
+ X-Ratelimit-Reset:
213
+ - '1526583600'
214
+ X-Request-Id:
215
+ - 5db434e0-0407-47b3-9cf2-ad0e8a29ee2d
216
+ X-Runtime:
217
+ - '0.069984'
218
+ X-Total-Count:
219
+ - '1'
220
+ X-Total-Pages:
221
+ - '1'
222
+ X-Updated-Since-Request-Synced-At:
223
+ - 2018-05-17 18:09:35 UTC
224
+ X-Xss-Protection:
225
+ - 1; mode=block
226
+ Date:
227
+ - Thu, 17 May 2018 18:09:35 GMT
228
+ Content-Length:
229
+ - '768'
230
+ body:
231
+ encoding: UTF-8
232
+ string: '{"links":{"messages.attachments":"https://www.bookingsync.com/api/v3/inbox/attachments/{messages.attachments}","messages.conversation":"https://www.bookingsync.com/api/v3/inbox/conversations/{messages.conversation}","messages.sender":"https://www.bookingsync.com/api/v3/inbox/participants/{messages.sender}"},"messages":[{"links":{"attachments":[1],"conversation":1,"sender":1},"channel":null,"content":"hey","created_at":"2018-05-17T13:50:43Z","id":1,"origin":"homeaway","sent_at":null,"updated_at":"2018-05-17T13:50:43Z","visibility":"external"}],"meta":{"Link":{"first":"https://www.bookingsync.com/api/v3/inbox/messages/1?page=1","last":"https://www.bookingsync.com/api/v3/inbox/messages/1?page=1"},"X-Total-Pages":"1","X-Total-Count":"1","X-Per-Page":"100"}}'
233
+ http_version:
234
+ recorded_at: Thu, 17 May 2018 18:09:35 GMT
235
+ recorded_with: VCR 4.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookingsync-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Grosjean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-16 00:00:00.000000000 Z
11
+ date: 2018-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -307,6 +307,7 @@ files:
307
307
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_edit_living_room/updates_given_living_room_by_ID.yml
308
308
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_room/returns_a_single_living_room.yml
309
309
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_rooms/returns_living_rooms.yml
310
+ - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_add_attachment_to_message/adds_attachment_to_given_message.yml
310
311
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_create_message/creates_a_new_message.yml
311
312
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_edit_message/updates_given_message_by_ID.yml
312
313
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_message/returns_a_single_message.yml
@@ -568,6 +569,7 @@ test_files:
568
569
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_edit_living_room/updates_given_living_room_by_ID.yml
569
570
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_room/returns_a_single_living_room.yml
570
571
  - spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_rooms/returns_living_rooms.yml
572
+ - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_add_attachment_to_message/adds_attachment_to_given_message.yml
571
573
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_create_message/creates_a_new_message.yml
572
574
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_edit_message/updates_given_message_by_ID.yml
573
575
  - spec/fixtures/cassettes/BookingSync_API_Client_Messages/_message/returns_a_single_message.yml