telegram_bot_middleware 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +72 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/examples/rack/config.ru +9 -0
- data/examples/sinatra/calc.rb +22 -0
- data/examples/sinatra/chuck_norris.rb +8 -0
- data/examples/sinatra/config.ru +12 -0
- data/examples/sinatra/example.rb +42 -0
- data/examples/sinatra/example_init.rb +9 -0
- data/lib/ostruct_nested.rb +18 -0
- data/lib/telegram_bot_middleware/version.rb +3 -0
- data/lib/telegram_bot_middleware.rb +172 -0
- data/telegram_bot_middleware.gemspec +27 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53104e93078e22a26e106dd70fbec85e2e5eefc0
|
4
|
+
data.tar.gz: 92d7d5da377b3708f52fabc3de79d339d418cd6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11a3edb593bcc3bca092c9abc94f00454c97d269cc5a85bb9ee40d682697d80a093949bba721f414025df1863cf4662bd7df4d1d5c666c415115e9da260450bc
|
7
|
+
data.tar.gz: 0f08fdccfa4588fea7a9f6070b8461eb69df2f2d76d3a0b0fcfe9964a3b3be3e6aea572088434ddd295a2808caddab46cce8623f59193b2ef95d7d034c242590
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
telegram_bot_middleware (0.1.0)
|
5
|
+
httmultiparty
|
6
|
+
http
|
7
|
+
persistent_httparty
|
8
|
+
rake (~> 10.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.8)
|
14
|
+
diff-lcs (1.2.5)
|
15
|
+
domain_name (0.5.25)
|
16
|
+
unf (>= 0.0.5, < 1.0.0)
|
17
|
+
gene_pool (1.4.1)
|
18
|
+
thread_safe
|
19
|
+
httmultiparty (0.3.16)
|
20
|
+
httparty (>= 0.7.3)
|
21
|
+
mimemagic
|
22
|
+
multipart-post
|
23
|
+
http (0.9.8)
|
24
|
+
addressable (~> 2.3)
|
25
|
+
http-cookie (~> 1.0)
|
26
|
+
http-form_data (~> 1.0.1)
|
27
|
+
http_parser.rb (~> 0.6.0)
|
28
|
+
http-cookie (1.0.2)
|
29
|
+
domain_name (~> 0.5)
|
30
|
+
http-form_data (1.0.1)
|
31
|
+
http_parser.rb (0.6.0)
|
32
|
+
httparty (0.13.7)
|
33
|
+
json (~> 1.8)
|
34
|
+
multi_xml (>= 0.5.2)
|
35
|
+
json (1.8.3)
|
36
|
+
mimemagic (0.3.0)
|
37
|
+
multi_xml (0.5.5)
|
38
|
+
multipart-post (2.0.0)
|
39
|
+
persistent_http (1.0.6)
|
40
|
+
gene_pool (>= 1.3)
|
41
|
+
persistent_httparty (0.1.2)
|
42
|
+
httparty (~> 0.9)
|
43
|
+
persistent_http (< 2)
|
44
|
+
rake (10.4.2)
|
45
|
+
rspec (3.3.0)
|
46
|
+
rspec-core (~> 3.3.0)
|
47
|
+
rspec-expectations (~> 3.3.0)
|
48
|
+
rspec-mocks (~> 3.3.0)
|
49
|
+
rspec-core (3.3.2)
|
50
|
+
rspec-support (~> 3.3.0)
|
51
|
+
rspec-expectations (3.3.1)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.3.0)
|
54
|
+
rspec-mocks (3.3.2)
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
+
rspec-support (~> 3.3.0)
|
57
|
+
rspec-support (3.3.0)
|
58
|
+
thread_safe (0.3.5)
|
59
|
+
unf (0.1.4)
|
60
|
+
unf_ext
|
61
|
+
unf_ext (0.0.7.1)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (~> 1.10)
|
68
|
+
rspec
|
69
|
+
telegram_bot_middleware!
|
70
|
+
|
71
|
+
BUNDLED WITH
|
72
|
+
1.10.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Mirko Mignini
|
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/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# TelegramBotMiddleware
|
2
|
+
|
3
|
+
Rack middleware to communicate with a telegram bot.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'telegram_bot_middleware'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install telegram_bot_middleware
|
20
|
+
|
21
|
+
TODO: Write more installation instructions.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MirkoMignini/telegram_bot_middleware. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "telegram_bot_middleware"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require_relative '../../lib/telegram_bot_middleware'
|
2
|
+
|
3
|
+
use TelegramBotMiddleware do |config|
|
4
|
+
config.token = '138381425:AAEXjzZx5U5wZmiKvFmHjdNMkXJqnkHnum4'
|
5
|
+
config.host = 'http://127.0.0.1:9292'
|
6
|
+
config.get_updates = :polling
|
7
|
+
end
|
8
|
+
|
9
|
+
run Proc.new { |env| [200, {'Content-Type' => 'text/html'}, ['Hello world!']] }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'example_init'
|
2
|
+
|
3
|
+
calc_string = ''
|
4
|
+
|
5
|
+
get %r{calc/?$}i do
|
6
|
+
calc_string = ''
|
7
|
+
{
|
8
|
+
text: "Let's calc!",
|
9
|
+
reply_markup: {keyboard: [%w(7 8 9 *), %w(4 5 6 /), %w(1 2 3 -), %w(0 . = +)], resize_keyboard: true, one_time_keyboard: false, selective: false}
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
get %r{(0|1|2|3|4|5|6|7|8|9|\*|\/|-|\.|\+)$} do |cmd|
|
14
|
+
calc_string += cmd
|
15
|
+
end
|
16
|
+
|
17
|
+
get '/=' do
|
18
|
+
{
|
19
|
+
text: eval(calc_string).to_s,
|
20
|
+
reply_markup: {hide_keyboard: true}
|
21
|
+
}
|
22
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'example_init'
|
2
|
+
|
3
|
+
get %r{/hello$}i do
|
4
|
+
{
|
5
|
+
text: "Hello #{params['from']['first_name']} #{params['from']['last_name']}!",
|
6
|
+
reply_markup: {keyboard: [%w(A B), ['C', 'D']], resize_keyboard: true, one_time_keyboard: true, selective: false}
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
get %r{/hello/(.*)}i do |name|
|
11
|
+
"Hello #{name}!"
|
12
|
+
end
|
13
|
+
|
14
|
+
get %r{/image/?$}i do
|
15
|
+
send_file 'tmp/test.png'
|
16
|
+
end
|
17
|
+
|
18
|
+
get %r{/audio/?$}i do
|
19
|
+
send_file 'tmp/test.mp3'
|
20
|
+
end
|
21
|
+
|
22
|
+
get %r{/video/?$}i do
|
23
|
+
send_file 'tmp/test.mp4'
|
24
|
+
end
|
25
|
+
|
26
|
+
get %r{/location/?$}i do
|
27
|
+
{
|
28
|
+
latitude: 38.115036,
|
29
|
+
longitude: 13.366640
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
get %r{/caption/?$}i do
|
34
|
+
{
|
35
|
+
photo: File.new('tmp/test.png'),
|
36
|
+
caption: 'caption'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
get '*' do
|
41
|
+
"Sono giapponese \u{0FE4E5}"
|
42
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require_relative '../../lib/telegram_bot_middleware'
|
3
|
+
|
4
|
+
use TelegramBotMiddleware do |config|
|
5
|
+
config.token = '138381425:AAEXjzZx5U5wZmiKvFmHjdNMkXJqnkHnum4'
|
6
|
+
#config.host = 'https://telegram-bot-middleware.herokuapp.com'
|
7
|
+
config.host = 'http://127.0.0.1:9292'
|
8
|
+
config.get_updates = :polling
|
9
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class OpenStruct
|
5
|
+
def to_h_nested
|
6
|
+
hash = self.to_h
|
7
|
+
hash.each do |key, value|
|
8
|
+
if value.is_a? OpenStruct
|
9
|
+
hash[key] = value.to_h_nested
|
10
|
+
end
|
11
|
+
end
|
12
|
+
hash
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.from_json(json_string)
|
16
|
+
JSON.parse(json_string, object_class: OpenStruct)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'rack'
|
2
|
+
require 'uri'
|
3
|
+
require 'http'
|
4
|
+
require 'httmultiparty'
|
5
|
+
require 'persistent_httparty'
|
6
|
+
require_relative 'ostruct_nested'
|
7
|
+
require_relative 'telegram_bot_middleware/version'
|
8
|
+
|
9
|
+
class TelegramBotMiddleware
|
10
|
+
include HTTMultiParty
|
11
|
+
base_uri 'https://api.telegram.org'
|
12
|
+
persistent_connection_adapter pool_size: 1,
|
13
|
+
keep_alive: 30,
|
14
|
+
force_retry: true
|
15
|
+
|
16
|
+
def initialize(app, &block)
|
17
|
+
# save the app var
|
18
|
+
@app = app
|
19
|
+
|
20
|
+
puts 'Initializing...'
|
21
|
+
|
22
|
+
# create the config and populate passing do the block function
|
23
|
+
@config = OpenStruct.new
|
24
|
+
yield(@config) if block_given?
|
25
|
+
|
26
|
+
# setup webhook
|
27
|
+
if @config.webhook.nil?
|
28
|
+
@config.host = "#{@config.host}/" unless @config.host.end_with?('/')
|
29
|
+
@config.webhook = "#{@config.host}#{@config.token}"
|
30
|
+
end
|
31
|
+
|
32
|
+
# setup telegram messages input
|
33
|
+
case @config.get_updates
|
34
|
+
|
35
|
+
# setup polling
|
36
|
+
when :polling
|
37
|
+
# clear the webhook in case was set in the past
|
38
|
+
send_to_bot('setWebhook', {url: ''})
|
39
|
+
|
40
|
+
# setup a thread with get_updates function
|
41
|
+
start_get_updates_thread
|
42
|
+
|
43
|
+
# setup webhook
|
44
|
+
when :webhook
|
45
|
+
send_to_bot('setWebhook', {url: @config.webhook})
|
46
|
+
|
47
|
+
# in this case get_updates is a non valid value
|
48
|
+
else
|
49
|
+
raise ArgumentError.new('Config error: get_updates must be :webhook or :polling.')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def start_get_updates_thread
|
54
|
+
# start a new thread
|
55
|
+
Thread.new do
|
56
|
+
# the initial offset is always 0
|
57
|
+
@offset = 0
|
58
|
+
# wait 5 seconds to don't risk to post message too early when the app is not still up
|
59
|
+
sleep 5
|
60
|
+
# loop forever
|
61
|
+
loop do
|
62
|
+
# call the getUpdates telegram function
|
63
|
+
response = send_to_bot('getUpdates', {offset: @offset})
|
64
|
+
# enumerate the results
|
65
|
+
response.to_hash['result'].each do |data|
|
66
|
+
# create an update message from the post data
|
67
|
+
update = OpenStruct.new(data)
|
68
|
+
# store the last offset +1 but ensure that is not lower than the already stored
|
69
|
+
@offset = (update.update_id + 1) if update.update_id + 1 > @offset
|
70
|
+
# simulate a post to itself
|
71
|
+
HTTP.post @config.webhook, json: update.to_h_nested
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# necessary for thread safe
|
78
|
+
def call(env)
|
79
|
+
dup._call(env)
|
80
|
+
end
|
81
|
+
|
82
|
+
def _call(env)
|
83
|
+
# retrieve the request object
|
84
|
+
req = Rack::Request.new(env)
|
85
|
+
|
86
|
+
# if the request is a post to bot webhhok
|
87
|
+
if req.post? and req.path == "/#{@config.token}"
|
88
|
+
|
89
|
+
# in case someone already read it
|
90
|
+
req.body.rewind
|
91
|
+
# build an openstruct based on post params
|
92
|
+
params = OpenStruct.from_json(req.body.read)
|
93
|
+
|
94
|
+
# build path based on message
|
95
|
+
# - get only message part of post params
|
96
|
+
# - remove empty chars from beginning or end (strip)
|
97
|
+
# - replace first sequence of spaces with /
|
98
|
+
# - encode as uri
|
99
|
+
path = URI.escape(params.message.text.strip.sub(/\s+/, '/'))
|
100
|
+
# - add first / if not present
|
101
|
+
path = "/#{path}" unless path.start_with?('/')
|
102
|
+
|
103
|
+
# build the querystring using message but nested
|
104
|
+
query_string = Rack::Utils.build_nested_query(params.message.to_h_nested)
|
105
|
+
|
106
|
+
# transform the POST in GET
|
107
|
+
env['PATH_INFO'] = path
|
108
|
+
env['QUERY_STRING'] = query_string
|
109
|
+
env['REQUEST_METHOD'] = 'GET'
|
110
|
+
env['REQUEST_URI'] = "https://#{req.host}#{path}"
|
111
|
+
# TODO use update(hash) { |name, old_value, new_value| }
|
112
|
+
|
113
|
+
# call the rack stack
|
114
|
+
status, headers, body = @app.call(env)
|
115
|
+
|
116
|
+
if status == 200 or status == '200'
|
117
|
+
|
118
|
+
case headers['Content-Type'].split(';').first
|
119
|
+
when 'text/html', 'application/json'
|
120
|
+
|
121
|
+
if body.is_a? Hash
|
122
|
+
|
123
|
+
query = body.clone
|
124
|
+
query[:chat_id] = params.message.chat.id unless query.include?(:chat_id)
|
125
|
+
query[:reply_markup] = query[:reply_markup].to_json if query.include?(:reply_markup)
|
126
|
+
|
127
|
+
body = Array.new(1) { '' }
|
128
|
+
|
129
|
+
if query.include?(:text)
|
130
|
+
send_to_bot('sendMessage', query)
|
131
|
+
elsif query.include?(:latitude) and query.include?(:longitude)
|
132
|
+
send_to_bot('sendLocation', query)
|
133
|
+
elsif query.include?(:photo)
|
134
|
+
send_to_bot('sendPhoto', query)
|
135
|
+
elsif query.include?(:audio)
|
136
|
+
send_to_bot('sendAudio', query)
|
137
|
+
elsif query.include?(:video)
|
138
|
+
send_to_bot('sendVideo', query)
|
139
|
+
else
|
140
|
+
# TODO: invalid query
|
141
|
+
end
|
142
|
+
|
143
|
+
else
|
144
|
+
body.each do |data|
|
145
|
+
send_to_bot('sendMessage', {chat_id: params.message.chat.id, text: data})
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
when /(^image\/)/
|
150
|
+
send_to_bot('sendPhoto', {chat_id: params.message.chat.id, photo: File.new(body)})
|
151
|
+
|
152
|
+
when /(^audio\/)/
|
153
|
+
send_to_bot('sendAudio', {chat_id: params.message.chat.id, audio: File.new(body)})
|
154
|
+
|
155
|
+
when /(^video\/)/
|
156
|
+
send_to_bot('sendVideo', {chat_id: params.message.chat.id, video: File.new(body)})
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# return result
|
161
|
+
[status, headers, body]
|
162
|
+
else
|
163
|
+
# normal rack flow - not a bot call
|
164
|
+
@app.call(env)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def send_to_bot(path, query)
|
169
|
+
response = self.class.post("/bot#{@config.token}/#{path}", query: query)
|
170
|
+
# TODO check respobse error
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'telegram_bot_middleware/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "telegram_bot_middleware"
|
8
|
+
spec.version = TelegramBotMiddleware::VERSION
|
9
|
+
spec.authors = ["Mirko Mignini"]
|
10
|
+
spec.email = ["mirko.mignini@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rack middleware to communicate with a telegram bot.}
|
13
|
+
spec.homepage = 'https://github.com/MirkoMignini/telegram_bot_middleware'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency 'rake', '~> 10.0'
|
21
|
+
spec.add_dependency 'http'
|
22
|
+
spec.add_dependency 'httmultiparty'
|
23
|
+
spec.add_dependency 'persistent_httparty'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: telegram_bot_middleware
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mirko Mignini
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: http
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httmultiparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: persistent_httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- mirko.mignini@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- examples/rack/config.ru
|
116
|
+
- examples/sinatra/calc.rb
|
117
|
+
- examples/sinatra/chuck_norris.rb
|
118
|
+
- examples/sinatra/config.ru
|
119
|
+
- examples/sinatra/example.rb
|
120
|
+
- examples/sinatra/example_init.rb
|
121
|
+
- lib/ostruct_nested.rb
|
122
|
+
- lib/telegram_bot_middleware.rb
|
123
|
+
- lib/telegram_bot_middleware/version.rb
|
124
|
+
- telegram_bot_middleware.gemspec
|
125
|
+
homepage: https://github.com/MirkoMignini/telegram_bot_middleware
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.2.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Rack middleware to communicate with a telegram bot.
|
149
|
+
test_files: []
|