messenger_client 0.1.3 → 0.1.4

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: 9abd4f17e15ca59491666621b4a19e9b21906366
4
- data.tar.gz: 4fe280d04a1eef1bd8d66abcfd428071e123cd2d
3
+ metadata.gz: 524b8fdd5ffac1533800a6a5737614955ee99cbb
4
+ data.tar.gz: 3422f84c7585c921c58bc876e8acfc038477b0f4
5
5
  SHA512:
6
- metadata.gz: 14d7f640596a2ecac8ee30ebbd002e9817ae1b6539a1b4ebe29457cec0f5dd6952b6d891beb1db30688a422a348377f1ad95baaf8eb1f36487baf5f318ccd8c9
7
- data.tar.gz: 87a76d3effaddff9eaf1ba2d54d2d06c2681905ab8187c9ed014417c6ff7ae4e1efcae27442337786f76083c43d9294b69fb34c0a50f65f58e937f3b2486882e
6
+ metadata.gz: 48caaea31af3ef54007c7a5aa561b79c3bf44aadd7d8866cfb73cdded4e0fd8ca6449f3ad4a2ddb3f16cee391fc4318343d51a5c298c94ffd4f7ffaff9932ad1
7
+ data.tar.gz: fe6fde59c460a050bc1f214958c6cc8f8ae5cec4f8baa8d3c3f4accf2e9c74f2259c3a3560aaa0660c4b52d39b881b17e6b7825028039da90f79420fc74b52d9
@@ -1,8 +1,9 @@
1
1
  module MessengerClient
2
2
  module Message
3
3
  class Base < Struct
4
- def postback; respond_to?(:_postback) ? _postback : nil; end
5
- def text; respond_to?(:_text) ? _text : nil; end
4
+ def postback; respond_to?(:_postback) ? _postback : nil; end
5
+ def text; respond_to?(:_text) ? _text : nil; end
6
+ def thumbs_up?; false end
6
7
  end
7
8
  end
8
9
  end
@@ -1,5 +1,5 @@
1
1
  module MessengerClient
2
2
  module Message
3
- Image = Base.new(:id, :timestamp, :sender, :url, :sticker_id)
3
+ Image = Base.new(:id, :timestamp, :sender, :url)
4
4
  end
5
5
  end
@@ -0,0 +1,19 @@
1
+ module MessengerClient
2
+ module Message
3
+ Sticker = Base.new(:id, :timestamp, :sender, :url, :sticker_id) do
4
+ THUMBS = {
5
+ "369239263222822" => :small,
6
+ "369239343222814" => :medium,
7
+ "369239383222810" => :large,
8
+ }
9
+
10
+ def thumbs_up?
11
+ !!thumb_size
12
+ end
13
+
14
+ def thumb_size
15
+ THUMBS[sticker_id.to_s]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,5 +6,6 @@ require "messenger_client/message/location"
6
6
  require "messenger_client/message/postback"
7
7
  require "messenger_client/message/quick_reply"
8
8
  require "messenger_client/message/sender"
9
+ require "messenger_client/message/sticker"
9
10
  require "messenger_client/message/text"
10
11
  require "messenger_client/message/video"
@@ -27,7 +27,11 @@ module MessengerClient
27
27
  url = pl["url"]
28
28
  case attch["type"]
29
29
  when "image"
30
- MessengerClient::Message::Image.new(m["mid"], timestamp, sender, url, pl["sticker_id"])
30
+ if sid = pl["sticker_id"]
31
+ MessengerClient::Message::Sticker.new(m["mid"], timestamp, sender, url, sid)
32
+ else
33
+ MessengerClient::Message::Image.new(m["mid"], timestamp, sender, url)
34
+ end
31
35
  when "video"
32
36
  MessengerClient::Message::Video.new(m["mid"], timestamp, sender, url)
33
37
  when "audio"
@@ -1,3 +1,3 @@
1
1
  module MessengerClient
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messenger_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Cruz
@@ -105,6 +105,7 @@ files:
105
105
  - lib/messenger_client/message/postback.rb
106
106
  - lib/messenger_client/message/quick_reply.rb
107
107
  - lib/messenger_client/message/sender.rb
108
+ - lib/messenger_client/message/sticker.rb
108
109
  - lib/messenger_client/message/text.rb
109
110
  - lib/messenger_client/message/video.rb
110
111
  - lib/messenger_client/message_parser.rb