telegramAPI 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5589020558870cc7d0fa94427583ebb5292fc846
4
+ data.tar.gz: 469c987170dc46d74f169733f2521fc04e85b10c
5
+ SHA512:
6
+ metadata.gz: c192f745daf67b3b8f1bc261b744f72edf439662f57dae2c48f0b501b4ad397b46e1893184bc54425eef50f771ec53ad0224b5f7a2abb08784c379ee3691405e
7
+ data.tar.gz: 060ebad3d8aab1df3a2c62c5a018fffb6c9c78c7036b350f375f469e96796a8aa877cb789856e36e083c7ea217f487cafa278181104bd95789a5bfcb1156fbc3
data/lib/telegramAPI.rb CHANGED
@@ -33,8 +33,8 @@ class TelegramAPI
33
33
  p=[]
34
34
  params_s=""
35
35
 
36
- params.each do |param| p<<param.join("=") end
37
- params_s="?"+p.join("&") if p.length!=0
36
+ params.each do |param| p << param.join("=") end
37
+ params_s = "?#{p.join("&")}" if p.length!=0
38
38
 
39
39
  JSON.parse(open(@@core+@token+"/"+api+params_s).read)
40
40
  end
@@ -46,7 +46,7 @@ class TelegramAPI
46
46
  # Provide information about the bot itself
47
47
  # @return [User] Information about the bot
48
48
  def getMe
49
- User.new self.query("getMe")["result"]
49
+ User.new self.query("getMe")
50
50
  end
51
51
 
52
52
  # Get last updates, including last received messages
@@ -151,6 +151,19 @@ class TelegramAPI
151
151
  def getUserProfilePhotos id, options={}
152
152
  UserProfilePhotos.new self.query("getUserProfilePhotos", {"user_id"=>id}.merge(parse_hash(options)))["result"]
153
153
  end
154
+
155
+ # Kick the user user_id from the chat chat_id
156
+ # @param chat_id [Integer or String] ID of the chat, or @publicname
157
+ # @param user_id [Integer] ID of the user to kick
158
+ def kickChatMember chat_id, user_id
159
+ self.query "kickChatMember", {"chat_id"=>chat_id, "user_id"=>user_id}
160
+ end
161
+
162
+ # Unban user_id from chat_id
163
+ # see kickChatMember
164
+ def unbanChatMember chat_id, user_id
165
+ self.query "unbanChatMember", {"chat_id"=>chat_id, "user_id"=>user_id}
166
+ end
154
167
 
155
168
  protected :query, :parse_hash, :post
156
169
  end
@@ -48,7 +48,7 @@ end
48
48
  # Object describing a Message
49
49
  class Message
50
50
  attr_accessor :message_id, :from, :date, :chat, :forward_from, :forward_date,
51
- :reply_to_message, :text, :audio, :document, :photo, :sticker, :video,
51
+ :reply_to_message, :text, :audio, :document, :photo, :voice, :sticker, :video,
52
52
  :contact, :location, :new_chat_participant, :left_chat_participant,
53
53
  :new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_create
54
54
 
@@ -65,6 +65,7 @@ class Message
65
65
  @audio = Audio.new json["audio"]
66
66
  @document = Document.new json["document"]
67
67
  @photo = ArrayOf.new(json["photo"], PhotoSize).to_a
68
+ @voice = Voice.new json["voice"]
68
69
  @sticker = Sticker.new json["sticker"]
69
70
  @video = Video.new json["video"]
70
71
  @contact = Contact.new json["contact"]
@@ -113,6 +114,17 @@ class Document
113
114
  end
114
115
  end
115
116
 
117
+ class Voice
118
+ attr_accessor :file_id, :duration, :mime_type, :file_size
119
+ def initialize json
120
+ return if !json
121
+ @file_id = json["file_id"]
122
+ @duration = json["duration"]
123
+ @mime_type = json["mime_type"]
124
+ @file_size = json["file_size"]
125
+ end
126
+ end
127
+
116
128
  class Sticker
117
129
  attr_accessor :file_id, :width, :height, :thumb, :file_size
118
130
  def initialize json
@@ -168,7 +180,7 @@ class UserProfilePhotos
168
180
  @total_count = json["total_count"]
169
181
  @photos = []
170
182
  json["photos"].each do |p|
171
- @photos<<ArrayOf.new(p).to_a
183
+ @photos<<ArrayOf.new(p, PhotoSize).to_a
172
184
  end
173
185
  end
174
186
  end
metadata CHANGED
@@ -1,36 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegramAPI
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
5
- prerelease:
4
+ version: 1.0.17
6
5
  platform: ruby
7
6
  authors:
8
7
  - Benedetto Nespoli
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-10-06 00:00:00.000000000 Z
11
+ date: 2015-09-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rest-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.7'
22
- - - ! '>='
20
+ - - ">="
23
21
  - !ruby/object:Gem::Version
24
22
  version: 1.7.3
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ~>
27
+ - - "~>"
31
28
  - !ruby/object:Gem::Version
32
29
  version: '1.7'
33
- - - ! '>='
30
+ - - ">="
34
31
  - !ruby/object:Gem::Version
35
32
  version: 1.7.3
36
33
  description: A lightweight Ruby API for Telegram Bots
@@ -39,32 +36,31 @@ executables: []
39
36
  extensions: []
40
37
  extra_rdoc_files: []
41
38
  files:
39
+ - README.md
42
40
  - lib/telegramAPI.rb
43
41
  - lib/telegramObjects.rb
44
- - README.md
45
42
  homepage: https://github.com/bennesp/telegramAPI
46
43
  licenses:
47
44
  - MIT
45
+ metadata: {}
48
46
  post_install_message:
49
47
  rdoc_options: []
50
48
  require_paths:
51
49
  - lib
52
50
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
51
  requirements:
55
- - - ! '>='
52
+ - - ">="
56
53
  - !ruby/object:Gem::Version
57
54
  version: 1.9.2
58
55
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
56
  requirements:
61
- - - ! '>='
57
+ - - ">="
62
58
  - !ruby/object:Gem::Version
63
59
  version: '0'
64
60
  requirements: []
65
61
  rubyforge_project:
66
- rubygems_version: 1.8.23
62
+ rubygems_version: 2.5.1
67
63
  signing_key:
68
- specification_version: 3
64
+ specification_version: 4
69
65
  summary: Telegram API for Bots
70
66
  test_files: []