shopify_api 5.2.1 → 5.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/shopify_api/resources/ping/conversation.rb +27 -0
- data/lib/shopify_api/resources/ping/delivery_confirmation.rb +10 -0
- data/lib/shopify_api/resources/ping/message.rb +0 -1
- data/lib/shopify_api/version.rb +1 -1
- data/test/fixtures/ping/failed_delivery_confirmation.json +1 -0
- data/test/fixtures/ping/successful_delivery_confirmation.json +1 -0
- data/test/ping/conversation_test.rb +32 -0
- data/test/ping/message_test.rb +23 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b24e62339306bcf90e50246ef4e98f4ffa46c6a885d5859b14969f3aa1e62c9c
|
4
|
+
data.tar.gz: 7e57071a073cb0e5e2bda965a1ef4cef3cc42a968905b407df9184757a04ec3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5224d787f4cc65f3174fa894098af11b7342059510c916fc4359ab2285793053e97bfb8eee318e136410fe6fd67626f7146f7f7727f8dba4e5bcc1b32867d597
|
7
|
+
data.tar.gz: 54c9dfed163c44b51fd811ba38efcf4c157ffdcaad5b5cc7f064e035ad0c890d9580b20ed316b75f99cac6368eb19e17e19c1a2da1bb556eb49562dd3f947a72
|
data/CHANGELOG
CHANGED
@@ -13,6 +13,33 @@ module ShopifyAPI
|
|
13
13
|
message.save
|
14
14
|
message
|
15
15
|
end
|
16
|
+
|
17
|
+
def successful_delivery(message_id:, delivery_timestamp:)
|
18
|
+
delivery_details = ShopifyAPI::Ping::DeliveryConfirmation.new(
|
19
|
+
conversation_id: id,
|
20
|
+
message_id: message_id,
|
21
|
+
delivery_confirmation_details: {
|
22
|
+
delivered: true,
|
23
|
+
confirmation_timestamp: delivery_timestamp,
|
24
|
+
}
|
25
|
+
)
|
26
|
+
delivery_details.save
|
27
|
+
delivery_details
|
28
|
+
end
|
29
|
+
|
30
|
+
def failed_delivery(message_id:, delivery_timestamp:, details:)
|
31
|
+
delivery_details = ShopifyAPI::Ping::DeliveryConfirmation.new(
|
32
|
+
conversation_id: id,
|
33
|
+
message_id: message_id,
|
34
|
+
delivery_confirmation_details: {
|
35
|
+
delivered: false,
|
36
|
+
confirmation_timestamp: delivery_timestamp,
|
37
|
+
details: details,
|
38
|
+
}
|
39
|
+
)
|
40
|
+
delivery_details.save
|
41
|
+
delivery_details
|
42
|
+
end
|
16
43
|
end
|
17
44
|
end
|
18
45
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyAPI
|
4
|
+
module Ping
|
5
|
+
class DeliveryConfirmation < Base
|
6
|
+
self.prefix = "/admin/api/ping-api/v1/conversations/:conversation_id/messages/:message_id/"
|
7
|
+
self.collection_name = "delivery_confirmation"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/shopify_api/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"delivery_confirmation_details":{"delivery_timestamp":"2018-08-29T22:16:05.589479Z","delivered":"false","details":"Integration failed to deliver message."}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"delivery_confirmation_details":{"delivery_timestamp":"2018-08-29T22:16:05.589479Z","delivered":"true"}}
|
@@ -36,4 +36,36 @@ class PingConversationTest < Test::Unit::TestCase
|
|
36
36
|
|
37
37
|
assert_equal "d0c7a2e6-8084-4e79-8483-e4a1352b81f7", message.id
|
38
38
|
end
|
39
|
+
|
40
|
+
def test_successful_delivery
|
41
|
+
fake("api/ping-api/v1/conversations/123/messages/111/delivery_confirmation",
|
42
|
+
method: :post,
|
43
|
+
body: load_fixture('ping/successful_delivery_confirmation'))
|
44
|
+
|
45
|
+
conversation = ShopifyAPI::Ping::Conversation.new(id: '123')
|
46
|
+
delivery_confirmation = conversation.successful_delivery(
|
47
|
+
message_id: '111',
|
48
|
+
delivery_timestamp: "2018-08-29T22:16:05.589479Z"
|
49
|
+
)
|
50
|
+
|
51
|
+
assert_equal("true", delivery_confirmation.delivered)
|
52
|
+
assert_equal("2018-08-29T22:16:05.589479Z", delivery_confirmation.delivery_timestamp)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_failed_delivery
|
56
|
+
fake("api/ping-api/v1/conversations/123/messages/111/delivery_confirmation",
|
57
|
+
method: :post,
|
58
|
+
body: load_fixture('ping/failed_delivery_confirmation'))
|
59
|
+
|
60
|
+
conversation = ShopifyAPI::Ping::Conversation.new(id: '123')
|
61
|
+
delivery_confirmation = conversation.failed_delivery(
|
62
|
+
message_id: '111',
|
63
|
+
delivery_timestamp: Time.now.to_s,
|
64
|
+
details: "Integration failed to deliver message."
|
65
|
+
)
|
66
|
+
|
67
|
+
assert_equal("false", delivery_confirmation.delivered)
|
68
|
+
assert_equal("2018-08-29T22:16:05.589479Z", delivery_confirmation.delivery_timestamp)
|
69
|
+
assert_equal("Integration failed to deliver message.", delivery_confirmation.details)
|
70
|
+
end
|
39
71
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class PingMessageTest < Test::Unit::TestCase
|
6
|
+
def test_create_message
|
7
|
+
fake("api/ping-api/v1/conversations/123/messages",
|
8
|
+
method: :post,
|
9
|
+
body: load_fixture('ping/message'))
|
10
|
+
|
11
|
+
message = ShopifyAPI::Ping::Message.new(
|
12
|
+
dedupe_key: SecureRandom.uuid,
|
13
|
+
content: {
|
14
|
+
text: "Hello from shopify_api",
|
15
|
+
},
|
16
|
+
sender_id: 'test',
|
17
|
+
conversation_id: '123',
|
18
|
+
)
|
19
|
+
|
20
|
+
message.save
|
21
|
+
assert_equal("d0c7a2e6-8084-4e79-8483-e4a1352b81f7", message.id)
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- lib/shopify_api/resources/payment_details.rb
|
251
251
|
- lib/shopify_api/resources/ping.rb
|
252
252
|
- lib/shopify_api/resources/ping/conversation.rb
|
253
|
+
- lib/shopify_api/resources/ping/delivery_confirmation.rb
|
253
254
|
- lib/shopify_api/resources/ping/message.rb
|
254
255
|
- lib/shopify_api/resources/policy.rb
|
255
256
|
- lib/shopify_api/resources/price_rule.rb
|
@@ -374,7 +375,9 @@ files:
|
|
374
375
|
- test/fixtures/payment.json
|
375
376
|
- test/fixtures/payments.json
|
376
377
|
- test/fixtures/ping/conversation.json
|
378
|
+
- test/fixtures/ping/failed_delivery_confirmation.json
|
377
379
|
- test/fixtures/ping/message.json
|
380
|
+
- test/fixtures/ping/successful_delivery_confirmation.json
|
378
381
|
- test/fixtures/policies.json
|
379
382
|
- test/fixtures/price_rule.json
|
380
383
|
- test/fixtures/price_rules.json
|
@@ -429,6 +432,7 @@ files:
|
|
429
432
|
- test/order_test.rb
|
430
433
|
- test/payment_test.rb
|
431
434
|
- test/ping/conversation_test.rb
|
435
|
+
- test/ping/message_test.rb
|
432
436
|
- test/policy_test.rb
|
433
437
|
- test/price_rule_test.rb
|
434
438
|
- test/product_listing_test.rb
|