rubogram 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/rubogram/client.rb +9 -4
- data/lib/rubogram/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf20d7e9e9f962c595439c564a66e582e1db79b
|
4
|
+
data.tar.gz: 1e911640f6adf443188dd995deded04569e6e177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f95c974e87cf13e13fddff09f6e4ec5716042232fee452b3987c622e6f9f3e5d62b17737160caab9533710a78d502c329117ce858a1cef1ccdecf7be1c1fc686
|
7
|
+
data.tar.gz: 3fdd6010c4933787143a5860ca335fa86682552fe385cad0b554241191a25f5ca232d7eaf2d1824f476538315c1daa9e5d82e81627a29ec1f29e3afb7ed7c690
|
data/README.md
CHANGED
@@ -38,7 +38,15 @@ And then make your requests like this:
|
|
38
38
|
resp = client.send_message chat_id: '123', text: 'hello, machine world!'
|
39
39
|
```
|
40
40
|
|
41
|
-
|
41
|
+
So, as you can see `sendMessage` became `send_message` because of ruby guidelines(tm). But you can also use it like `client.sendMessage`, just like in the telegram docs.
|
42
|
+
|
43
|
+
Also you can use `call` method:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
resp = client.call 'sendMessage', chat_id: '123', text: 'Hello!'
|
47
|
+
```
|
48
|
+
|
49
|
+
You can see parsed response of all requests like this. Resp contains full Faraday response:
|
42
50
|
|
43
51
|
```ruby
|
44
52
|
resp.body
|
data/lib/rubogram/client.rb
CHANGED
@@ -29,13 +29,18 @@ module Rubogram
|
|
29
29
|
|
30
30
|
args.push({}) if args.size == 0
|
31
31
|
|
32
|
-
unless args[0].is_a? Hash
|
33
|
-
raise ArgumentError.new "argument must be a Hash"
|
34
|
-
end
|
35
|
-
|
36
32
|
method = method.to_s.split('_').inject([]){ |b,e| b.push(b.empty? ? e : e.capitalize) }.join
|
37
33
|
|
38
34
|
@faraday.post method, args[0]
|
39
35
|
end
|
36
|
+
|
37
|
+
# Call method from telegram api
|
38
|
+
def call method, args = {}
|
39
|
+
unless args.is_a? Hash
|
40
|
+
raise ArgumentError.new "argument must be a Hash"
|
41
|
+
end
|
42
|
+
|
43
|
+
@faraday.post method, args
|
44
|
+
end
|
40
45
|
end
|
41
46
|
end
|
data/lib/rubogram/version.rb
CHANGED