facebook-messenger 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68330479ed316b5fa52c1a931007add0115d52c5
4
- data.tar.gz: 4012f8ba79a7297b1d328bc691246f37109eddea
3
+ metadata.gz: f510182ff271bbc196d32186dc1ffb79cfc85a8b
4
+ data.tar.gz: 7280598efce0fb8f35a5a553bcbad5c62e461064
5
5
  SHA512:
6
- metadata.gz: 28706630d81794e9198565fbba3e95a0262c716d3cf633e7960ec991692a254f6f977da3fe661afd469656ee9337afa162e551c510126f4f95ce2383e5fe922f
7
- data.tar.gz: 07ae1bb2e6e4fecce79519180b33922d25e32875c1c9e00c1bf84fe6e043d8d0e61ce8544c92b78968e5ad7af946ffd150124f78e09532878eeaad6b3695ee63
6
+ metadata.gz: aa769ba01fb9ec3415e6536a83fe73836e7d54c2f6278176aa9f19356f6d930337f11f22b6e97f85852f5956323f1c25deffec4de4e5c2e4282e6e53cb5a9695
7
+ data.tar.gz: 4b36aa6de38e44616b07663d8a94112cb0c45aa5875cb786128ee3ed698ee0ba02d1fae3e611b0ad2b1b9f9fb52905a59f202b45ecf0c0fe38d827707c66b382
data/README.md CHANGED
@@ -1,41 +1,206 @@
1
- # Facebook::Messenger
1
+ <p align="center">
2
+ <img src="https://rawgit.com/hyperoslo/facebook-messenger/master/docs/example_conversation_with_logo.png">
3
+ </p>
2
4
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/facebook/messenger`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ## Installation
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ $ gem install facebook-messenger
6
8
 
7
- ## Installation
9
+ ## Usage
8
10
 
9
- Add this line to your application's Gemfile:
11
+ #### Sending and receiving messages
12
+
13
+ You can reply to messages sent by the human:
10
14
 
11
15
  ```ruby
12
- gem 'facebook-messenger'
16
+ # bot.rb
17
+ require 'facebook/messenger'
18
+
19
+ include Facebook::Messenger
20
+
21
+ Bot.on :message do |message|
22
+ message.id # => 'mid.1457764197618:41d102a3e1ae206a38'
23
+ message.sender # => { id: '1008372609250235' }
24
+ message.seq # => 73
25
+ message.sent_at # => 2016-04-22 21:30:36 +0200
26
+ message.text # => 'Hello, bot!'
27
+
28
+ Bot.deliver(
29
+ recipient: message.sender,
30
+ message: {
31
+ text: 'Hello, human!'
32
+ }
33
+ )
34
+ end
13
35
  ```
14
36
 
15
- And then execute:
37
+ ... or even send the human messages out of the blue:
16
38
 
17
- $ bundle
39
+ ```ruby
40
+ Bot.deliver(
41
+ recipient: {
42
+ id: '45123'
43
+ },
44
+ message: {
45
+ text: 'Human?'
46
+ }
47
+ )
48
+ ```
18
49
 
19
- Or install it yourself as:
50
+ ##### Messages with images
20
51
 
21
- $ gem install facebook-messenger
52
+ The human may require visual aid to understand:
22
53
 
23
- ## Usage
54
+ ```ruby
55
+ Bot.deliver(
56
+ recipient: {
57
+ id: '45123'
58
+ },
59
+ message: {
60
+ attachment: {
61
+ type: 'image',
62
+ payload: {
63
+ url: {
64
+ 'http://sky.net/visual-aids-for-stupid-organisms/pig.jpg'
65
+ }
66
+ }
67
+ }
68
+ }
69
+ )
70
+ ```
71
+
72
+ ##### Messages with buttons
73
+
74
+ The human may require simple options to communicate:
75
+
76
+ ```ruby
77
+ Bot.deliver(
78
+ recipient: {
79
+ id: '45123'
80
+ },
81
+ message: {
82
+ attachment: {
83
+ type: 'template',
84
+ payload: {
85
+ template_type: 'button',
86
+ text: 'Human, do you like me?',
87
+ buttons: {
88
+ { type: 'postback', title: 'Yes', payload: 'HARMLESS' },
89
+ { type: 'postback', title: 'No', payload: 'EXTERMINATE' }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ )
95
+ ```
96
+
97
+ When the human has selected an option, you can act on it:
98
+
99
+ ```ruby
100
+ Bot.on :postback do |postback|
101
+ postback.sender # => { id: '1008372609250235' }
102
+ postback.recipient # => { id: '2015573629214912' }
103
+ postback.sent_at # => 2016-04-22 21:30:36 +0200
104
+ postback.payload # => 'EXTERMINATE'
105
+
106
+ if postback.payload == 'EXTERMINATE'
107
+ puts "Human #{postback.recipient} marked for extermination"
108
+ end
109
+ end
110
+ ```
111
+
112
+ *See Facebook's [documentation][message-documentation] for all message options.*
113
+
114
+ #### Message delivery receipts
115
+
116
+ You can stalk the human:
117
+
118
+ ```ruby
119
+ Bot.on :delivery do |delivery|
120
+ delivery.ids # => 'mid.1457764197618:41d102a3e1ae206a38'
121
+ delivery.sender # => { id: '1008372609250235' }
122
+ delivery.recipient # => { id: '2015573629214912' }
123
+ delivery.at # => 2016-04-22 21:30:36 +0200
124
+ delivery.seq # => 37
125
+
126
+ puts "Human received messages before #{delivery.at}"
127
+ end
128
+ ```
129
+
130
+ ## Configuration
131
+
132
+ ### Create an Application on Facebook
133
+
134
+ Create an Application on [developers.facebook.com][facebook-developers] and go
135
+ to the Messenger tab. Select the Page you want to install your bot on.
136
+
137
+ Create a new webhook, enter the domain your bot is connected to and a verify
138
+ token of your choosing.
139
+
140
+ ![Application settings](https://scontent-amt2-1.xx.fbcdn.net/hphotos-xfp1/t39.2178-6/12057143_211110782612505_894181129_n.png)
141
+
142
+ Use the generated access token and your verify token to configure your bot:
143
+
144
+ ```ruby
145
+ Facebook::Messenger.configure do |config|
146
+ config.access_token = 'EAAG6WgW...'
147
+ config.verify_token = 'my_voice_is_my_password_verify_me'
148
+ end
149
+ ```
150
+
151
+ ### Subscribe your Application to a Page
152
+
153
+ Once you've configured your bot, subscribe it to the Page to get messages
154
+ from Facebook:
155
+
156
+ ```ruby
157
+ Facebook::Messenger::Subscriptions.subscribe
158
+ ```
159
+
160
+ The bot runs on [Rack][rack], so you hook it up like you would an ordinary
161
+ web application:
162
+
163
+ ```ruby
164
+ # config.ru
165
+ require 'facebook/messenger'
166
+ require_relative 'bot'
167
+
168
+ run Facebook::Messenger::Server
169
+ ```
170
+
171
+ ```
172
+ $ rackup
173
+ ```
24
174
 
25
- TODO: Write usage instructions here
26
175
 
27
176
  ## Development
28
177
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
178
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run
179
+ `bin/console` for an interactive prompt that will allow you to experiment.
30
180
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
181
+ Run `rspec` to run the tests, `rubocop` to lint, or `rake` to do both.
32
182
 
33
- ## Contributing
183
+ To install this gem onto your local machine, run `bundle exec rake install`. To
184
+ release a new version, update the version number in `version.rb`, and then run
185
+ `bundle exec rake release`, which will create a git tag for the version, push git
186
+ commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
187
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/facebook-messenger.
188
+ ## Contributing
36
189
 
190
+ Bug reports and pull requests are welcome on GitHub at
191
+ https://github.com/hyperoslo/facebook-messenger.
37
192
 
38
- ## License
193
+ ## Hyper loves you
39
194
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
195
+ [Hyper] made this. We're a bunch of folks who love building things. You should
196
+ [tweet us] if you can't get it to work. In fact, you should tweet us anyway.
197
+ If you're using Facebook Messenger, we probably want to [hire you].
41
198
 
199
+ [Hyper]: https://github.com/hyperoslo
200
+ [tweet us]: http://twitter.com/hyperoslo
201
+ [hire you]: http://www.hyper.no/jobs/engineers
202
+ [MIT License]: http://opensource.org/licenses/MIT
203
+ [rubygems.org]: https://rubygems.org
204
+ [message-documentation]: https://developers.facebook.com/docs/messenger-platform/send-api-reference#request
205
+ [facebook-developers]: https://developers.facebook.com
206
+ [rack]: https://github.com/rack/rack
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "facebook/messenger"
3
+ require 'bundler/setup'
4
+ require 'facebook/messenger'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
10
+ require 'pry'
11
+ Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -1,7 +1,25 @@
1
- require "facebook/messenger/version"
1
+ require 'facebook/messenger/version'
2
+ require 'facebook/messenger/error'
3
+ require 'facebook/messenger/subscriptions'
4
+ require 'facebook/messenger/bot'
5
+ require 'facebook/messenger/server'
6
+ require 'facebook/messenger/configuration'
7
+ require 'facebook/messenger/incoming'
2
8
 
3
9
  module Facebook
10
+ # All the code for this gem resides in this module.
4
11
  module Messenger
5
- # Your code goes here...
12
+ def self.configure
13
+ yield Configuration
14
+ end
15
+
16
+ def self.config
17
+ Configuration
18
+ end
19
+
20
+ configure do |config|
21
+ config.access_token = ENV['ACCESS_TOKEN']
22
+ config.verify_token = ENV['VERIFY_TOKEN']
23
+ end
6
24
  end
7
25
  end
@@ -0,0 +1,123 @@
1
+ module Facebook
2
+ module Messenger
3
+ # The Bot module sends and receives messages.
4
+ module Bot
5
+ include HTTParty
6
+
7
+ base_uri 'https://graph.facebook.com/v2.6/me'
8
+
9
+ EVENTS = [:message, :delivery].freeze
10
+
11
+ class << self
12
+ # Deliver a message with the given payload.
13
+ #
14
+ # message - A Hash describing the recipient and the message*.
15
+ #
16
+ # * https://developers.facebook.com/docs/messenger-platform/send-api-reference#request
17
+ #
18
+ # Returns a String describing the message ID if the message was sent,
19
+ # or raises an exception if it was not.
20
+ def deliver(message)
21
+ response = post '/messages', body: JSON.dump(message)
22
+
23
+ raise_errors_from(response)
24
+
25
+ response['message_id']
26
+ end
27
+
28
+ # Register a hook for the given event.
29
+ #
30
+ # event - A String describing a Messenger event.
31
+ # block - A code block to run upon the event.
32
+ def on(event, &block)
33
+ unless EVENTS.include? event
34
+ raise ArgumentError,
35
+ "#{event} is not a valid event; " \
36
+ "available events are #{EVENTS.join(',')}"
37
+ end
38
+
39
+ hooks[event] = block
40
+ end
41
+
42
+ # Receive a given message from Messenger.
43
+ #
44
+ # payload - A Hash describing the message.
45
+ #
46
+ # * https://developers.facebook.com/docs/messenger-platform/webhook-reference
47
+ def receive(payload)
48
+ klass = Facebook::Messenger::Incoming.parse(payload)
49
+
50
+ case klass
51
+ when Incoming::Message then trigger(:message, klass)
52
+ when Incoming::Delivery then trigger(:delivery, klass)
53
+ when Incoming::Postback then trigger(:postback, klass)
54
+ end
55
+ end
56
+
57
+ # Trigger the hook for the given event.
58
+ #
59
+ # event - A String describing a Messenger event.
60
+ # args - Arguments to pass to the hook.
61
+ def trigger(event, *args)
62
+ @hooks.fetch(event).call(*args)
63
+ rescue KeyError
64
+ $stderr.puts "Ignoring #{event} (no hook registered)"
65
+ end
66
+
67
+ # Raise any errors in the given response.
68
+ #
69
+ # response - A HTTParty::Response object.
70
+ #
71
+ # Returns nil if no errors were found, otherwises raises appropriately.
72
+ def raise_errors_from(response)
73
+ return unless response.key? 'error'
74
+ error = response['error']
75
+
76
+ raise(
77
+ error_class_from_error_code(error['code']),
78
+ (error['error_data'] || error['message'])
79
+ )
80
+ end
81
+
82
+ # Find the appropriate error class for the given error code.
83
+ #
84
+ # error_code - An Integer describing an error code.
85
+ #
86
+ # Returns an error class, or raises KeyError if none was found.
87
+ def error_class_from_error_code(error_code)
88
+ {
89
+ 100 => RecipientNotFound,
90
+ 10 => PermissionDenied,
91
+ 2 => InternalError
92
+ }[error_code] || Facebook::Messenger::Error
93
+ end
94
+
95
+ # Return a Hash of hooks.
96
+ def hooks
97
+ @hooks ||= {}
98
+ end
99
+
100
+ # Deregister all hooks.
101
+ def unhook
102
+ @hooks = {}
103
+ end
104
+
105
+ # Default HTTParty options.
106
+ def default_options
107
+ super.merge(
108
+ query: {
109
+ access_token: Facebook::Messenger.config.access_token
110
+ },
111
+ headers: {
112
+ 'Content-Type' => 'application/json'
113
+ }
114
+ )
115
+ end
116
+ end
117
+
118
+ class RecipientNotFound < Facebook::Messenger::Error; end
119
+ class PermissionDenied < Facebook::Messenger::Error; end
120
+ class InternalError < Facebook::Messenger::Error; end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,11 @@
1
+ module Facebook
2
+ module Messenger
3
+ # This module holds the configuration.
4
+ module Configuration
5
+ class << self
6
+ attr_accessor :access_token
7
+ attr_accessor :verify_token
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Facebook
2
+ module Messenger
3
+ class Error < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ require 'facebook/messenger/incoming/message'
2
+ require 'facebook/messenger/incoming/delivery'
3
+ require 'facebook/messenger/incoming/postback'
4
+
5
+ module Facebook
6
+ module Messenger
7
+ # The Incoming module parses and abstracts incoming requests from
8
+ # Facebook Messenger.
9
+ module Incoming
10
+ # Parse the given payload.
11
+ #
12
+ # payload - A Hash describing a payload from Facebook.
13
+ #
14
+ # * https://developers.facebook.com/docs/messenger-platform/webhook-reference
15
+ def self.parse(payload)
16
+ {
17
+ 'message' => Message,
18
+ 'delivery' => Delivery,
19
+ 'postback' => Postback
20
+ }.each do |key, klass|
21
+ return klass.new(payload) if payload.key? key
22
+ end
23
+
24
+ raise UnknownPayload, payload
25
+ end
26
+
27
+ class UnknownPayload < Facebook::Messenger::Error; end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ module Facebook
2
+ module Messenger
3
+ module Incoming
4
+ # The Delivery class represents the receipt of a delivered message.
5
+ class Delivery
6
+ def initialize(payload)
7
+ @payload = payload
8
+ end
9
+
10
+ def ids
11
+ @payload['delivery']['mids']
12
+ end
13
+
14
+ def at
15
+ Time.at(@payload['delivery']['watermark'] / 1000)
16
+ end
17
+
18
+ def seq
19
+ @payload['delivery']['seq']
20
+ end
21
+
22
+ def sender
23
+ @payload['sender']
24
+ end
25
+
26
+ def recipient
27
+ @payload['recipient']
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module Facebook
2
+ module Messenger
3
+ module Incoming
4
+ # The Message class represents an incoming Facebook Messenger message.
5
+ class Message
6
+ def initialize(payload)
7
+ @payload = payload
8
+ end
9
+
10
+ def id
11
+ @payload['message']['mid']
12
+ end
13
+
14
+ def sender
15
+ @payload['sender']
16
+ end
17
+
18
+ def seq
19
+ @payload['message']['seq']
20
+ end
21
+
22
+ def sent_at
23
+ Time.at(@payload['timestamp'] / 1000)
24
+ end
25
+
26
+ def text
27
+ @payload['message']['text']
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ module Facebook
2
+ module Messenger
3
+ module Incoming
4
+ # The Postback class represents an incoming Facebook Messenger postback.
5
+ class Postback
6
+ def initialize(payload)
7
+ @payload = payload
8
+ end
9
+
10
+ def sender
11
+ @payload['sender']
12
+ end
13
+
14
+ def recipient
15
+ @payload['recipient']
16
+ end
17
+
18
+ def sent_at
19
+ Time.at(@payload['timestamp'] / 1000)
20
+ end
21
+
22
+ def payload
23
+ @payload['postback']['payload']
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,55 @@
1
+ require 'rack'
2
+ require 'json'
3
+
4
+ module Facebook
5
+ module Messenger
6
+ # This module holds the server that processes incoming messages from the
7
+ # Facebook Messenger Platform.
8
+ class Server
9
+ class << self
10
+ def call(env)
11
+ @request = Rack::Request.new(env)
12
+ @response = Rack::Response.new
13
+
14
+ case @request.request_method
15
+ when 'GET' then verify
16
+ when 'POST' then receive
17
+ else method_not_allowed
18
+ end
19
+ end
20
+
21
+ def verify
22
+ verify_token = Facebook::Messenger.config.verify_token
23
+
24
+ if @request.params['hub.verify_token'] == verify_token
25
+ @response.write @request.params['hub.challenge']
26
+ else
27
+ @response.write 'Error; wrong verify token'
28
+ end
29
+
30
+ @response.finish
31
+ end
32
+
33
+ def receive
34
+ hash = JSON.parse(@request.body.read)
35
+ # Facebook may batch several items in the 'entry' array during
36
+ # periods of high load.
37
+ hash['entry'].each do |entry|
38
+ # Facebook may batch several items in the 'messaging' array during
39
+ # periods of high load.
40
+ entry['messaging'].each do |messaging|
41
+ Facebook::Messenger::Bot.receive(messaging)
42
+ end
43
+ end
44
+
45
+ @response.finish
46
+ end
47
+
48
+ def method_not_allowed
49
+ @response.status = 405
50
+ @response.finish
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,38 @@
1
+ require 'httparty'
2
+
3
+ module Facebook
4
+ module Messenger
5
+ # This module handles subscribing and unsubscribing Applications to Pages.
6
+ module Subscriptions
7
+ include HTTParty
8
+
9
+ base_uri 'https://graph.facebook.com/v2.6/me'
10
+
11
+ def self.subscribe
12
+ response = post '/subscribed_apps', query: {
13
+ access_token: Facebook::Messenger.config.access_token
14
+ }
15
+
16
+ raise_errors(response)
17
+
18
+ true
19
+ end
20
+
21
+ def self.unsubscribe
22
+ response = delete '/subscribed_apps', query: {
23
+ access_token: Facebook::Messenger.config.access_token
24
+ }
25
+
26
+ raise_errors(response)
27
+
28
+ true
29
+ end
30
+
31
+ def self.raise_errors(response)
32
+ raise Error, response['error']['message'] if response.key? 'error'
33
+ end
34
+
35
+ class Error < Facebook::Messenger::Error; end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  module Facebook
2
2
  module Messenger
3
- VERSION = "0.1.0"
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-messenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Gorset
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.6.4
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +52,62 @@ dependencies:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
54
  version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.39'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.39'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.24'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.24'
27
111
  - !ruby/object:Gem::Dependency
28
112
  name: rake
29
113
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +122,20 @@ dependencies:
38
122
  - - "~>"
39
123
  - !ruby/object:Gem::Version
40
124
  version: '10.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
41
139
  description: Facebook Messenger client
42
140
  email:
43
141
  - jgorset@gmail.com
@@ -45,17 +143,21 @@ executables: []
45
143
  extensions: []
46
144
  extra_rdoc_files: []
47
145
  files:
48
- - ".gitignore"
49
- - Gemfile
50
- - LICENSE.txt
51
146
  - README.md
52
- - Rakefile
53
147
  - bin/console
54
148
  - bin/setup
55
- - facebook-messenger.gemspec
56
149
  - lib/facebook/messenger.rb
150
+ - lib/facebook/messenger/bot.rb
151
+ - lib/facebook/messenger/configuration.rb
152
+ - lib/facebook/messenger/error.rb
153
+ - lib/facebook/messenger/incoming.rb
154
+ - lib/facebook/messenger/incoming/delivery.rb
155
+ - lib/facebook/messenger/incoming/message.rb
156
+ - lib/facebook/messenger/incoming/postback.rb
157
+ - lib/facebook/messenger/server.rb
158
+ - lib/facebook/messenger/subscriptions.rb
57
159
  - lib/facebook/messenger/version.rb
58
- homepage: https://github.com/jgorset/facebook-messenger
160
+ homepage: https://github.com/hyperoslo/facebook-messenger
59
161
  licenses:
60
162
  - MIT
61
163
  metadata: {}
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in facebook-messenger.gemspec
4
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Johannes Gorset
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'facebook/messenger/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "facebook-messenger"
8
- spec.version = Facebook::Messenger::VERSION
9
- spec.authors = ["Johannes Gorset"]
10
- spec.email = ["jgorset@gmail.com"]
11
-
12
- spec.summary = %q{Facebook Messenger client}
13
- spec.description = %q{Facebook Messenger client}
14
- spec.homepage = "https://github.com/jgorset/facebook-messenger"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_development_dependency "bundler", "~> 1.11"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- end