igni 0.0.1 → 0.0.2

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: 088b66f66c9f6b578faaf33fc6bafe2218428132
4
- data.tar.gz: 67e5993dee713ac1d35e7d6c93267ea76af5268a
3
+ metadata.gz: 294e745a0fff3a0644580984888aafc17a3e2a88
4
+ data.tar.gz: 8a278fa70aa8fbbe2e00b99adebee8c990892097
5
5
  SHA512:
6
- metadata.gz: 45f05586f044264b8cc6fd38652ca7c89eb04046b19e597e5ffb56e41b8f217c297d0e4b91e1c4eddc2390d48ecb461e4f32be676c152da007a4bb49d82e6e64
7
- data.tar.gz: 07cf334a4bed76238992425f5cbb2be5bd1c73d06444351addee0765c4f715c5d96bd67ef8fa40a7bccd71da4e7df5c876c86634d23b0ac0b313a69024708ff2
6
+ metadata.gz: 0bf693b109ba5248b073f406ee35ca02832534c2e4569ac4883abb5207987a8618cc984f742aefe4de9cd3bfc6102a9a59b41539f422c97a7894dd4a7e055cec
7
+ data.tar.gz: 10646dbdd12a05dc7c610327a664a73dda20f698beaac8dc93cbbd2883c864060e323997f70092b214357b79772e857a9325401e3eb8d89207a50746337de8a8
data/README.md CHANGED
@@ -22,7 +22,9 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Access message raw data:
26
+
27
+ message["raw"]
26
28
 
27
29
  ## Development
28
30
 
@@ -38,4 +40,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
40
  ## License
39
41
 
40
42
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
data/lib/igni/api.rb CHANGED
@@ -3,12 +3,6 @@ require 'json'
3
3
 
4
4
  module Igni
5
5
  class API
6
- attr_accessor :token
7
-
8
- def initialize(token)
9
- @token = token
10
- end
11
-
12
6
  def request(method, payload)
13
7
  req = Unirest.post("https://api.telegram.org/bot#{@token}/#{method}",
14
8
  parameters: payload)
data/lib/igni/bot.rb CHANGED
@@ -4,6 +4,8 @@ require 'igni/api'
4
4
 
5
5
  module Igni
6
6
  class Bot < Sinatra::Base
7
+ include Igni::API
8
+
7
9
  attr_reader :token
8
10
  attr_reader :hook
9
11
  attr_reader :API
@@ -41,6 +43,7 @@ module Igni
41
43
  raw = request.env["rack.input"].read
42
44
 
43
45
  data = JSON.parse(raw)
46
+ data["raw"] = raw
44
47
 
45
48
  Thread.new { self.@handler(data) } if @handler != nil
46
49
  end
data/lib/igni/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Igni
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/igni.rb CHANGED
@@ -1,2 +1 @@
1
- require "igni/version"
2
1
  require "igni/bot"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: igni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Viktorov