message_quickly 1.1.0 → 1.1.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/lib/message_quickly/callback.rb +1 -0
- data/lib/message_quickly/callback_parser.rb +2 -2
- data/lib/message_quickly/messaging/delivery_event.rb +6 -1
- data/lib/message_quickly/messaging/event.rb +4 -9
- data/lib/message_quickly/messaging/message_event.rb +8 -2
- data/lib/message_quickly/messaging/optin_event.rb +4 -1
- data/lib/message_quickly/messaging/postback_event.rb +4 -1
- data/lib/message_quickly/version.rb +1 -1
- data/spec/callback_parser_spec.rb +13 -1
- data/spec/dummy/log/test.log +2353 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3941141a3b987cc51445285e7f24801af2f281f
|
4
|
+
data.tar.gz: 583bac20cd4d1dee6ea978455e5de86dd3ae28ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37fafb514a0b6bc99bdd50fcd7d4886ef6e6906062ec082a5708b352d9e62f6ed95e109ca7a6ebfa35161422ada85268c526e548e90abbaa53a0d6fdb304aa4b
|
7
|
+
data.tar.gz: ee9e975a5d10b0a698bd052033256eaff75b0c9a9377a1d6b1a66c6b452b995550abdaf798f68aef70ffa296d48e76ec35a81c29408477f8c8c27dd6bd35f319
|
@@ -48,7 +48,7 @@ module MessageQuickly
|
|
48
48
|
events = []
|
49
49
|
process_entry_json(@json['entry']) do |params|
|
50
50
|
WEBHOOK_LOOKUP.keys.each do |key|
|
51
|
-
if params[:messaging][key
|
51
|
+
if params[:messaging][key]
|
52
52
|
events << WEBHOOK_LOOKUP[key].new(params[:messaging])
|
53
53
|
break
|
54
54
|
end
|
@@ -78,7 +78,7 @@ module MessageQuickly
|
|
78
78
|
sender: sender,
|
79
79
|
recipient: recipient,
|
80
80
|
timestamp: timestamp,
|
81
|
-
messaging: event_json
|
81
|
+
messaging: event_json.deep_symbolize_keys
|
82
82
|
}
|
83
83
|
end
|
84
84
|
|
@@ -7,7 +7,12 @@ module MessageQuickly
|
|
7
7
|
attr_reader :mids, :watermark, :seq
|
8
8
|
|
9
9
|
def initialize(params = {})
|
10
|
-
|
10
|
+
if params.include? :delivery
|
11
|
+
@mids = params[:delivery][:mids]
|
12
|
+
@watermark = params[:delivery][:watermark]
|
13
|
+
@seq = params[:delivery][:seq]
|
14
|
+
params.delete(:delivery)
|
15
|
+
end
|
11
16
|
super(params)
|
12
17
|
end
|
13
18
|
|
@@ -5,15 +5,10 @@ module MessageQuickly
|
|
5
5
|
attr_reader :entry, :sender, :recipient, :timestamp
|
6
6
|
|
7
7
|
def initialize(params = {})
|
8
|
-
|
9
|
-
@
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def initialize_params(params)
|
16
|
-
params.each { |key, value| instance_variable_set("@#{key}", value) }
|
8
|
+
params.deep_symbolize_keys!
|
9
|
+
@sender = Sender.new(params.delete(:sender)) if params.include?(:sender)
|
10
|
+
@recipient = Recipient.new(params.delete(:recipient)) if params.include?(:recipient)
|
11
|
+
super
|
17
12
|
end
|
18
13
|
|
19
14
|
end
|
@@ -7,7 +7,13 @@ module MessageQuickly
|
|
7
7
|
attr_reader :mid, :seq, :text, :attachments
|
8
8
|
|
9
9
|
def initialize(params = {})
|
10
|
-
|
10
|
+
@attachments = params[:message].delete(:attachments).collect { |attachment_params| Attachment.new(attachment_params) } if params.include?(:message) && params[:message].include?(:attachments)
|
11
|
+
if params.include? :message
|
12
|
+
@mid = params[:message][:mid]
|
13
|
+
@seq = params[:message][:seq]
|
14
|
+
@text = params[:message][:text]
|
15
|
+
params.delete(:message)
|
16
|
+
end
|
11
17
|
super(params)
|
12
18
|
end
|
13
19
|
|
@@ -18,7 +24,7 @@ module MessageQuickly
|
|
18
24
|
protected
|
19
25
|
|
20
26
|
def initialize_params(params)
|
21
|
-
|
27
|
+
|
22
28
|
super(params)
|
23
29
|
end
|
24
30
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
module MessageQuickly
|
4
4
|
|
5
5
|
describe CallbackParser do
|
6
|
-
|
6
|
+
|
7
7
|
context 'with a optin request' do
|
8
8
|
|
9
9
|
let(:optin_json) { JSON.parse(File.read("spec/fixtures/optin_request.json")) }
|
@@ -37,6 +37,18 @@ module MessageQuickly
|
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
+
context 'with a message request with attachment' do
|
41
|
+
|
42
|
+
let(:message_json) { JSON.parse(File.read("spec/fixtures/message_request_with_attachment.json")) }
|
43
|
+
|
44
|
+
subject { CallbackParser.new(message_json) }
|
45
|
+
|
46
|
+
it { expect { |b| subject.parse(&b) }.to yield_with_args(Messaging::MessageEvent) }
|
47
|
+
it { expect(subject.parse).not_to be_empty }
|
48
|
+
it { expect(subject.parse.first.attachments).not_to be_empty }
|
49
|
+
|
50
|
+
end
|
51
|
+
|
40
52
|
context 'with a postback request' do
|
41
53
|
|
42
54
|
let(:postback_json) { JSON.parse(File.read("spec/fixtures/postback_request.json")) }
|