rubogram 0.1.3 → 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: 3f56781b942b79ccbd950f1137a68a7ed38611ed
4
- data.tar.gz: 72f71808ec6f79c0b3774de2f2d49719e8c6479e
3
+ metadata.gz: faf20d7e9e9f962c595439c564a66e582e1db79b
4
+ data.tar.gz: 1e911640f6adf443188dd995deded04569e6e177
5
5
  SHA512:
6
- metadata.gz: 01a49171f40fd2e0c6e5e23028128dceb46db6159566d616f0b905fc7a52f75b11fb9a40dd25d8cbb942efb11f229a50628d618db0c17106fbcd0f32a748f7e3
7
- data.tar.gz: 745e12d2f32520b41dbfc8d1ee450be541bf7fc32d6b0a11c34fecf11aeef28fc9c64218d96e6759a8bd84f68974253ad4221be4c65c2c236a2acad4a80b2035
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
- You can see parsed response like this:
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Rubogram
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubogram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Viktorov