telegram-bot-ruby 0.9.0 → 0.9.1

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
  SHA256:
3
- metadata.gz: 46df3e677efb20c202616015ee9f147a8c9cb82378ddf4361cd77a982a4b9130
4
- data.tar.gz: 2b48882f2251bb5200d7776dc7ba46cfdb92651dd7a94051e4ffea931942bee6
3
+ metadata.gz: b2cb7116b2990f0bccbc7fadb1e34106a1e2ffe5fe319f79ee7907f01f4ee918
4
+ data.tar.gz: 46965b28805fecefee9b2f8beaa8b8d5bca6f539ef3bdd390e5bd5d31b146ced
5
5
  SHA512:
6
- metadata.gz: cd38e725718bd3e2eff039aa0c1fef81f98459d080646cbdfdd48c9d6db87819fd6b1ad7f3a406538d03b4520aa3ad531bed5a216296cb3b904aae1a09ec90e5
7
- data.tar.gz: 6c94d7f6409777dcb8c89aa89f68f4d5f3281025e05700ae9f8905d98e0285b0b201db7a2b698033ad449a4998ed91df4a16e2ac73837915dae47a371d309c75
6
+ metadata.gz: e73e3e3690a75a9de50e87af8effa1fd53a95b281f325fa230bd09d9e4f8ac9129aa9811064573469fdc6e15de1000f0b3554af8af8d0f1ab4a17d94edb45e6c
7
+ data.tar.gz: 79699f7dbda65732c6b940a54e6d39d0ea880481a7614e3d786f50902cab9ef67955a094420db9f300237972ed752166be6b0dd4c2d5c6683dd4c2c297e7b502
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.1
4
+
5
+ - Allow to configure API URL (thx [@markfrst][])
6
+
3
7
  ## 0.9.0
4
8
 
5
9
  - Implement [Bot API 4.2](https://core.telegram.org/bots/api-changelog#april-14-2019)
@@ -73,3 +77,4 @@
73
77
  - Let `Client#logger` be overwritten later (use `attr_accessor` instead of `attr_reader`)
74
78
 
75
79
  [@ivanovaleksey]: https://github.com/ivanovaleksey
80
+ [@markfrst]: https://github.com/markfrst
data/README.md CHANGED
@@ -56,6 +56,16 @@ Same thing about `message` object - it implements [Message](https://core.telegra
56
56
 
57
57
  If you are going to use [webhooks](https://core.telegram.org/bots/api#setwebhook) instead of [long polling](https://core.telegram.org/bots/api#getupdates), you need to implement your own webhook callbacks server. Take a look at [this repo](https://github.com/solyaris/BOTServer) as an example.
58
58
 
59
+ ## Proxy
60
+
61
+ As some countries block access to Telegram, you can set up your own proxy and use it to access Telegram API. In this case you need to configure API url:
62
+
63
+ ```ruby
64
+ Telegram::Bot::Client.run(token, url: 'https://proxy.example.com') do |bot|
65
+ # ...
66
+ end
67
+ ```
68
+
59
69
  ## Custom keyboards
60
70
 
61
71
  You can use your own [custom keyboards](https://core.telegram.org/bots#keyboards). Here is an example:
@@ -48,10 +48,11 @@ module Telegram
48
48
  Telegram::Bot::Types::InlineQueryResultCachedAudio
49
49
  ].freeze
50
50
 
51
- attr_reader :token
51
+ attr_reader :token, :url
52
52
 
53
- def initialize(token)
53
+ def initialize(token, url: 'https://api.telegram.org')
54
54
  @token = token
55
+ @url = url
55
56
  end
56
57
 
57
58
  def method_missing(method_name, *args, &block)
@@ -110,7 +111,7 @@ module Telegram
110
111
  end
111
112
 
112
113
  def conn
113
- @conn ||= Faraday.new(url: 'https://api.telegram.org') do |faraday|
114
+ @conn ||= Faraday.new(url: url) do |faraday|
114
115
  faraday.request :multipart
115
116
  faraday.request :url_encoded
116
117
  faraday.adapter Telegram::Bot.configuration.adapter
@@ -8,9 +8,9 @@ module Telegram
8
8
  new(*args).run(&block)
9
9
  end
10
10
 
11
- def initialize(token, h = {})
12
- @options = default_options.merge(h)
13
- @api = Api.new(token)
11
+ def initialize(token, hash = {})
12
+ @options = default_options.merge(hash)
13
+ @api = Api.new(token, url: options.delete(:url))
14
14
  @logger = options.delete(:logger)
15
15
  end
16
16
 
@@ -44,7 +44,12 @@ module Telegram
44
44
  private
45
45
 
46
46
  def default_options
47
- { offset: 0, timeout: 20, logger: NullLogger.new }
47
+ {
48
+ offset: 0,
49
+ timeout: 20,
50
+ logger: NullLogger.new,
51
+ url: 'https://api.telegram.org'
52
+ }
48
53
  end
49
54
 
50
55
  def log_incoming_message(message)
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.9.0'.freeze
3
+ VERSION = '0.9.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-bot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-09 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday