teleswagger 0.1.0 → 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.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/LICENSE +201 -0
  4. data/README.md +88 -74
  5. data/docs/AnswerCallbackQueryBody.md +12 -0
  6. data/docs/AttachmentsApi.md +166 -3
  7. data/docs/CallbacksApi.md +6 -18
  8. data/docs/Chat.md +2 -0
  9. data/docs/ChatsApi.md +112 -9
  10. data/docs/EditMessageCaptionBody.md +1 -0
  11. data/docs/EditMessageLiveLocationBody.md +13 -0
  12. data/docs/GamesApi.md +5 -5
  13. data/docs/GetUpdatesBody.md +11 -0
  14. data/docs/InlineApi.md +1 -1
  15. data/docs/InlineQueryResultAudio.md +1 -0
  16. data/docs/InlineQueryResultCachedAudio.md +1 -0
  17. data/docs/InlineQueryResultCachedDocument.md +1 -0
  18. data/docs/InlineQueryResultCachedGif.md +1 -0
  19. data/docs/InlineQueryResultCachedMpeg4Gif.md +1 -0
  20. data/docs/InlineQueryResultCachedPhoto.md +1 -0
  21. data/docs/InlineQueryResultCachedVideo.md +1 -0
  22. data/docs/InlineQueryResultCachedVoice.md +1 -0
  23. data/docs/InlineQueryResultDocument.md +1 -0
  24. data/docs/InlineQueryResultGif.md +1 -0
  25. data/docs/InlineQueryResultLocation.md +1 -0
  26. data/docs/InlineQueryResultMpeg4Gif.md +1 -0
  27. data/docs/InlineQueryResultPhoto.md +1 -0
  28. data/docs/InlineQueryResultVideo.md +1 -0
  29. data/docs/InlineQueryResultVoice.md +1 -0
  30. data/docs/InlineResponse200.md +1 -1
  31. data/docs/InlineResponse2001.md +1 -1
  32. data/docs/InlineResponse2002.md +1 -1
  33. data/docs/InlineResponse2003.md +1 -1
  34. data/docs/InlineResponse2004.md +1 -1
  35. data/docs/InlineResponse2005.md +1 -1
  36. data/docs/InlineResponse2006.md +1 -1
  37. data/docs/InlineResponse2007.md +1 -1
  38. data/docs/InlineResponse2008.md +1 -1
  39. data/docs/InlineResponse2009.md +1 -1
  40. data/docs/InputLocationMessageContent.md +1 -0
  41. data/docs/InputMediaPhoto.md +11 -0
  42. data/docs/InputMediaVideo.md +15 -0
  43. data/docs/Message.md +3 -0
  44. data/docs/MessagesApi.md +7 -7
  45. data/docs/PaymentsApi.md +1 -1
  46. data/docs/ReplyKeyboardMarkup.md +1 -1
  47. data/docs/SendInvoiceBody.md +1 -0
  48. data/docs/SendLocationBody.md +1 -0
  49. data/docs/SendMediaGroupLinkBody.md +11 -0
  50. data/docs/StickersApi.md +3 -3
  51. data/docs/StopMessageLiveLocationBody.md +11 -0
  52. data/docs/UpdatesApi.md +4 -8
  53. data/docs/UsersApi.md +5 -5
  54. data/git_push.sh +67 -0
  55. data/lib/teleswagger.rb +20 -2
  56. data/lib/teleswagger/api/attachments_api.rb +367 -158
  57. data/lib/teleswagger/api/callbacks_api.rb +29 -47
  58. data/lib/teleswagger/api/chats_api.rb +316 -192
  59. data/lib/teleswagger/api/games_api.rb +46 -35
  60. data/lib/teleswagger/api/inline_api.rb +21 -8
  61. data/lib/teleswagger/api/messages_api.rb +84 -71
  62. data/lib/teleswagger/api/payments_api.rb +39 -26
  63. data/lib/teleswagger/api/stickers_api.rb +107 -116
  64. data/lib/teleswagger/api/updates_api.rb +50 -39
  65. data/lib/teleswagger/api/users_api.rb +36 -23
  66. data/lib/teleswagger/api_client.rb +45 -55
  67. data/lib/teleswagger/api_error.rb +18 -9
  68. data/lib/teleswagger/configuration.rb +13 -8
  69. data/lib/teleswagger/models/add_sticker_to_set_link_body.rb +16 -21
  70. data/lib/teleswagger/models/allowed_update.rb +15 -2
  71. data/lib/teleswagger/models/animation.rb +16 -9
  72. data/lib/teleswagger/models/answer_callback_query_body.rb +235 -0
  73. data/lib/teleswagger/models/answer_inline_query_body.rb +16 -13
  74. data/lib/teleswagger/models/answer_shipping_query_body.rb +16 -13
  75. data/lib/teleswagger/models/audio.rb +16 -5
  76. data/lib/teleswagger/models/callback_game.rb +16 -5
  77. data/lib/teleswagger/models/callback_query.rb +16 -5
  78. data/lib/teleswagger/models/chat.rb +38 -17
  79. data/lib/teleswagger/models/chat_member.rb +16 -13
  80. data/lib/teleswagger/models/chat_photo.rb +16 -5
  81. data/lib/teleswagger/models/chosen_inline_result.rb +16 -17
  82. data/lib/teleswagger/models/contact.rb +16 -5
  83. data/lib/teleswagger/models/create_new_sticker_set_link_body.rb +16 -25
  84. data/lib/teleswagger/models/document.rb +16 -5
  85. data/lib/teleswagger/models/edit_message_caption_body.rb +26 -6
  86. data/lib/teleswagger/models/edit_message_live_location_body.rb +246 -0
  87. data/lib/teleswagger/models/edit_message_reply_markup_body.rb +16 -5
  88. data/lib/teleswagger/models/edit_message_text_body.rb +16 -9
  89. data/lib/teleswagger/models/error.rb +16 -5
  90. data/lib/teleswagger/models/file.rb +16 -5
  91. data/lib/teleswagger/models/force_reply.rb +16 -5
  92. data/lib/teleswagger/models/game.rb +16 -17
  93. data/lib/teleswagger/models/game_high_score.rb +16 -5
  94. data/lib/teleswagger/models/get_updates_body.rb +228 -0
  95. data/lib/teleswagger/models/inline_keyboard_button.rb +16 -5
  96. data/lib/teleswagger/models/inline_keyboard_markup.rb +16 -5
  97. data/lib/teleswagger/models/inline_query.rb +16 -5
  98. data/lib/teleswagger/models/inline_query_result_article.rb +16 -21
  99. data/lib/teleswagger/models/inline_query_result_audio.rb +26 -22
  100. data/lib/teleswagger/models/inline_query_result_cached_audio.rb +26 -18
  101. data/lib/teleswagger/models/inline_query_result_cached_document.rb +26 -18
  102. data/lib/teleswagger/models/inline_query_result_cached_gif.rb +26 -18
  103. data/lib/teleswagger/models/inline_query_result_cached_mpeg4_gif.rb +26 -18
  104. data/lib/teleswagger/models/inline_query_result_cached_photo.rb +26 -18
  105. data/lib/teleswagger/models/inline_query_result_cached_sticker.rb +16 -17
  106. data/lib/teleswagger/models/inline_query_result_cached_video.rb +26 -18
  107. data/lib/teleswagger/models/inline_query_result_cached_voice.rb +26 -18
  108. data/lib/teleswagger/models/inline_query_result_contact.rb +16 -21
  109. data/lib/teleswagger/models/inline_query_result_document.rb +26 -26
  110. data/lib/teleswagger/models/inline_query_result_game.rb +16 -17
  111. data/lib/teleswagger/models/inline_query_result_gif.rb +26 -22
  112. data/lib/teleswagger/models/inline_query_result_location.rb +50 -24
  113. data/lib/teleswagger/models/inline_query_result_mpeg4_gif.rb +26 -22
  114. data/lib/teleswagger/models/inline_query_result_photo.rb +26 -22
  115. data/lib/teleswagger/models/inline_query_result_venue.rb +16 -29
  116. data/lib/teleswagger/models/inline_query_result_video.rb +26 -30
  117. data/lib/teleswagger/models/inline_query_result_voice.rb +26 -22
  118. data/lib/teleswagger/models/inline_response_200.rb +17 -6
  119. data/lib/teleswagger/models/inline_response_200_1.rb +17 -6
  120. data/lib/teleswagger/models/inline_response_200_2.rb +20 -7
  121. data/lib/teleswagger/models/inline_response_200_3.rb +17 -6
  122. data/lib/teleswagger/models/inline_response_200_4.rb +18 -9
  123. data/lib/teleswagger/models/inline_response_200_5.rb +17 -6
  124. data/lib/teleswagger/models/inline_response_200_6.rb +17 -6
  125. data/lib/teleswagger/models/inline_response_200_7.rb +17 -6
  126. data/lib/teleswagger/models/inline_response_200_8.rb +17 -6
  127. data/lib/teleswagger/models/inline_response_200_9.rb +17 -6
  128. data/lib/teleswagger/models/inline_type.rb +13 -2
  129. data/lib/teleswagger/models/input_contact_message_content.rb +16 -13
  130. data/lib/teleswagger/models/input_location_message_content.rb +51 -13
  131. data/lib/teleswagger/models/input_media_photo.rb +228 -0
  132. data/lib/teleswagger/models/input_media_video.rb +264 -0
  133. data/lib/teleswagger/models/input_text_message_content.rb +16 -9
  134. data/lib/teleswagger/models/input_venue_message_content.rb +16 -21
  135. data/lib/teleswagger/models/invoice.rb +16 -5
  136. data/lib/teleswagger/models/keyboard_button.rb +16 -5
  137. data/lib/teleswagger/models/labeled_price.rb +16 -5
  138. data/lib/teleswagger/models/location.rb +16 -5
  139. data/lib/teleswagger/models/mask_position.rb +16 -5
  140. data/lib/teleswagger/models/message.rb +49 -9
  141. data/lib/teleswagger/models/message_entity.rb +16 -5
  142. data/lib/teleswagger/models/order_info.rb +16 -5
  143. data/lib/teleswagger/models/parse_mode.rb +13 -2
  144. data/lib/teleswagger/models/photo_size.rb +16 -5
  145. data/lib/teleswagger/models/pre_checkout_query.rb +16 -5
  146. data/lib/teleswagger/models/promote_chat_member_body.rb +16 -13
  147. data/lib/teleswagger/models/reply_keyboard_markup.rb +17 -6
  148. data/lib/teleswagger/models/reply_keyboard_remove.rb +16 -5
  149. data/lib/teleswagger/models/response_bool.rb +16 -5
  150. data/lib/teleswagger/models/response_message.rb +16 -5
  151. data/lib/teleswagger/models/response_parameters.rb +16 -5
  152. data/lib/teleswagger/models/response_update.rb +16 -5
  153. data/lib/teleswagger/models/restrict_chat_member_body.rb +16 -13
  154. data/lib/teleswagger/models/send_audio_link_body.rb +16 -13
  155. data/lib/teleswagger/models/send_contact_body.rb +16 -17
  156. data/lib/teleswagger/models/send_document_link_body.rb +16 -13
  157. data/lib/teleswagger/models/send_game_body.rb +16 -13
  158. data/lib/teleswagger/models/send_invoice_body.rb +26 -38
  159. data/lib/teleswagger/models/send_location_body.rb +50 -16
  160. data/lib/teleswagger/models/send_media_group_link_body.rb +230 -0
  161. data/lib/teleswagger/models/send_message_body.rb +16 -13
  162. data/lib/teleswagger/models/send_photo_link_body.rb +16 -13
  163. data/lib/teleswagger/models/send_sticker_link_body.rb +16 -13
  164. data/lib/teleswagger/models/send_venue_body.rb +16 -25
  165. data/lib/teleswagger/models/send_video_link_body.rb +16 -13
  166. data/lib/teleswagger/models/send_video_note_link_body.rb +16 -13
  167. data/lib/teleswagger/models/send_voice_link_body.rb +16 -13
  168. data/lib/teleswagger/models/shipping_address.rb +16 -5
  169. data/lib/teleswagger/models/shipping_option.rb +16 -5
  170. data/lib/teleswagger/models/shipping_query.rb +16 -5
  171. data/lib/teleswagger/models/sticker.rb +16 -5
  172. data/lib/teleswagger/models/sticker_set.rb +16 -5
  173. data/lib/teleswagger/models/stop_message_live_location_body.rb +226 -0
  174. data/lib/teleswagger/models/successful_payment.rb +16 -5
  175. data/lib/teleswagger/models/update.rb +16 -5
  176. data/lib/teleswagger/models/user.rb +16 -5
  177. data/lib/teleswagger/models/user_profile_photos.rb +16 -5
  178. data/lib/teleswagger/models/venue.rb +16 -5
  179. data/lib/teleswagger/models/video.rb +16 -5
  180. data/lib/teleswagger/models/video_note.rb +16 -5
  181. data/lib/teleswagger/models/voice.rb +16 -5
  182. data/lib/teleswagger/models/webhook_info.rb +16 -17
  183. data/lib/teleswagger/version.rb +15 -4
  184. data/spec/models/answer_callback_query_body_spec.rb +77 -0
  185. data/spec/models/edit_message_live_location_body_spec.rb +83 -0
  186. data/spec/models/get_updates_body_spec.rb +71 -0
  187. data/spec/models/input_media_photo_spec.rb +71 -0
  188. data/spec/models/input_media_video_spec.rb +95 -0
  189. data/spec/models/send_media_group_link_body_spec.rb +71 -0
  190. data/spec/models/stop_message_live_location_body_spec.rb +71 -0
  191. data/swagger.yaml +428 -52
  192. data/teleswagger.gemspec +17 -8
  193. metadata +45 -14
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -94,7 +105,7 @@ module Teleswagger
94
105
  def build_from_hash(attributes)
95
106
  return nil unless attributes.is_a?(Hash)
96
107
  self.class.swagger_types.each_pair do |key, type|
97
- if type =~ /\AArray<(.*)>/i
108
+ if type =~ /^Array<(.*)>/i
98
109
  # check to ensure the input is an array given that the the attribute
99
110
  # is documented as an array but the input is not
100
111
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -125,7 +136,7 @@ module Teleswagger
125
136
  when :Float
126
137
  value.to_f
127
138
  when :BOOLEAN
128
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
129
140
  true
130
141
  else
131
142
  false
@@ -136,7 +147,7 @@ module Teleswagger
136
147
  when /\AArray<(?<inner_type>.+)>\z/
137
148
  inner_type = Regexp.last_match[:inner_type]
138
149
  value.map { |v| _deserialize(inner_type, v) }
139
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
140
151
  k_type = Regexp.last_match[:k_type]
141
152
  v_type = Regexp.last_match[:v_type]
142
153
  {}.tap do |hash|
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -82,18 +93,6 @@ module Teleswagger
82
93
  # @return Array for valid properies with the reasons
83
94
  def list_invalid_properties
84
95
  invalid_properties = Array.new
85
- if @result_id.nil?
86
- invalid_properties.push("invalid value for 'result_id', result_id cannot be nil.")
87
- end
88
-
89
- if @from.nil?
90
- invalid_properties.push("invalid value for 'from', from cannot be nil.")
91
- end
92
-
93
- if @query.nil?
94
- invalid_properties.push("invalid value for 'query', query cannot be nil.")
95
- end
96
-
97
96
  return invalid_properties
98
97
  end
99
98
 
@@ -136,7 +135,7 @@ module Teleswagger
136
135
  def build_from_hash(attributes)
137
136
  return nil unless attributes.is_a?(Hash)
138
137
  self.class.swagger_types.each_pair do |key, type|
139
- if type =~ /\AArray<(.*)>/i
138
+ if type =~ /^Array<(.*)>/i
140
139
  # check to ensure the input is an array given that the the attribute
141
140
  # is documented as an array but the input is not
142
141
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -167,7 +166,7 @@ module Teleswagger
167
166
  when :Float
168
167
  value.to_f
169
168
  when :BOOLEAN
170
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
171
170
  true
172
171
  else
173
172
  false
@@ -178,7 +177,7 @@ module Teleswagger
178
177
  when /\AArray<(?<inner_type>.+)>\z/
179
178
  inner_type = Regexp.last_match[:inner_type]
180
179
  value.map { |v| _deserialize(inner_type, v) }
181
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
182
181
  k_type = Regexp.last_match[:k_type]
183
182
  v_type = Regexp.last_match[:v_type]
184
183
  {}.tap do |hash|
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -112,7 +123,7 @@ module Teleswagger
112
123
  def build_from_hash(attributes)
113
124
  return nil unless attributes.is_a?(Hash)
114
125
  self.class.swagger_types.each_pair do |key, type|
115
- if type =~ /\AArray<(.*)>/i
126
+ if type =~ /^Array<(.*)>/i
116
127
  # check to ensure the input is an array given that the the attribute
117
128
  # is documented as an array but the input is not
118
129
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -143,7 +154,7 @@ module Teleswagger
143
154
  when :Float
144
155
  value.to_f
145
156
  when :BOOLEAN
146
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
147
158
  true
148
159
  else
149
160
  false
@@ -154,7 +165,7 @@ module Teleswagger
154
165
  when /\AArray<(?<inner_type>.+)>\z/
155
166
  inner_type = Regexp.last_match[:inner_type]
156
167
  value.map { |v| _deserialize(inner_type, v) }
157
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
158
169
  k_type = Regexp.last_match[:k_type]
159
170
  v_type = Regexp.last_match[:v_type]
160
171
  {}.tap do |hash|
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -98,26 +109,6 @@ module Teleswagger
98
109
  # @return Array for valid properies with the reasons
99
110
  def list_invalid_properties
100
111
  invalid_properties = Array.new
101
- if @user_id.nil?
102
- invalid_properties.push("invalid value for 'user_id', user_id cannot be nil.")
103
- end
104
-
105
- if @name.nil?
106
- invalid_properties.push("invalid value for 'name', name cannot be nil.")
107
- end
108
-
109
- if @title.nil?
110
- invalid_properties.push("invalid value for 'title', title cannot be nil.")
111
- end
112
-
113
- if @png_sticker.nil?
114
- invalid_properties.push("invalid value for 'png_sticker', png_sticker cannot be nil.")
115
- end
116
-
117
- if @emojis.nil?
118
- invalid_properties.push("invalid value for 'emojis', emojis cannot be nil.")
119
- end
120
-
121
112
  return invalid_properties
122
113
  end
123
114
 
@@ -164,7 +155,7 @@ module Teleswagger
164
155
  def build_from_hash(attributes)
165
156
  return nil unless attributes.is_a?(Hash)
166
157
  self.class.swagger_types.each_pair do |key, type|
167
- if type =~ /\AArray<(.*)>/i
158
+ if type =~ /^Array<(.*)>/i
168
159
  # check to ensure the input is an array given that the the attribute
169
160
  # is documented as an array but the input is not
170
161
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -195,7 +186,7 @@ module Teleswagger
195
186
  when :Float
196
187
  value.to_f
197
188
  when :BOOLEAN
198
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
199
190
  true
200
191
  else
201
192
  false
@@ -206,7 +197,7 @@ module Teleswagger
206
197
  when /\AArray<(?<inner_type>.+)>\z/
207
198
  inner_type = Regexp.last_match[:inner_type]
208
199
  value.map { |v| _deserialize(inner_type, v) }
209
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
210
201
  k_type = Regexp.last_match[:k_type]
211
202
  v_type = Regexp.last_match[:v_type]
212
203
  {}.tap do |hash|
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -121,7 +132,7 @@ module Teleswagger
121
132
  def build_from_hash(attributes)
122
133
  return nil unless attributes.is_a?(Hash)
123
134
  self.class.swagger_types.each_pair do |key, type|
124
- if type =~ /\AArray<(.*)>/i
135
+ if type =~ /^Array<(.*)>/i
125
136
  # check to ensure the input is an array given that the the attribute
126
137
  # is documented as an array but the input is not
127
138
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -152,7 +163,7 @@ module Teleswagger
152
163
  when :Float
153
164
  value.to_f
154
165
  when :BOOLEAN
155
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
156
167
  true
157
168
  else
158
169
  false
@@ -163,7 +174,7 @@ module Teleswagger
163
174
  when /\AArray<(?<inner_type>.+)>\z/
164
175
  inner_type = Regexp.last_match[:inner_type]
165
176
  value.map { |v| _deserialize(inner_type, v) }
166
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
167
178
  k_type = Regexp.last_match[:k_type]
168
179
  v_type = Regexp.last_match[:v_type]
169
180
  {}.tap do |hash|
@@ -3,10 +3,21 @@
3
3
 
4
4
  #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
5
 
6
- OpenAPI spec version: 3.3
6
+ OpenAPI spec version: 3.6
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -23,6 +34,8 @@ module Teleswagger
23
34
 
24
35
  attr_accessor :caption
25
36
 
37
+ attr_accessor :parse_mode
38
+
26
39
  attr_accessor :reply_markup
27
40
 
28
41
 
@@ -33,6 +46,7 @@ module Teleswagger
33
46
  :'message_id' => :'message_id',
34
47
  :'inline_message_id' => :'inline_message_id',
35
48
  :'caption' => :'caption',
49
+ :'parse_mode' => :'parse_mode',
36
50
  :'reply_markup' => :'reply_markup'
37
51
  }
38
52
  end
@@ -44,6 +58,7 @@ module Teleswagger
44
58
  :'message_id' => :'Integer',
45
59
  :'inline_message_id' => :'String',
46
60
  :'caption' => :'String',
61
+ :'parse_mode' => :'ParseMode',
47
62
  :'reply_markup' => :'InlineKeyboardMarkup'
48
63
  }
49
64
  end
@@ -72,6 +87,10 @@ module Teleswagger
72
87
  self.caption = attributes[:'caption']
73
88
  end
74
89
 
90
+ if attributes.has_key?(:'parse_mode')
91
+ self.parse_mode = attributes[:'parse_mode']
92
+ end
93
+
75
94
  if attributes.has_key?(:'reply_markup')
76
95
  self.reply_markup = attributes[:'reply_markup']
77
96
  end
@@ -100,6 +119,7 @@ module Teleswagger
100
119
  message_id == o.message_id &&
101
120
  inline_message_id == o.inline_message_id &&
102
121
  caption == o.caption &&
122
+ parse_mode == o.parse_mode &&
103
123
  reply_markup == o.reply_markup
104
124
  end
105
125
 
@@ -112,7 +132,7 @@ module Teleswagger
112
132
  # Calculates hash code according to all attributes.
113
133
  # @return [Fixnum] Hash code
114
134
  def hash
115
- [chat_id, message_id, inline_message_id, caption, reply_markup].hash
135
+ [chat_id, message_id, inline_message_id, caption, parse_mode, reply_markup].hash
116
136
  end
117
137
 
118
138
  # Builds the object from hash
@@ -121,7 +141,7 @@ module Teleswagger
121
141
  def build_from_hash(attributes)
122
142
  return nil unless attributes.is_a?(Hash)
123
143
  self.class.swagger_types.each_pair do |key, type|
124
- if type =~ /\AArray<(.*)>/i
144
+ if type =~ /^Array<(.*)>/i
125
145
  # check to ensure the input is an array given that the the attribute
126
146
  # is documented as an array but the input is not
127
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -152,7 +172,7 @@ module Teleswagger
152
172
  when :Float
153
173
  value.to_f
154
174
  when :BOOLEAN
155
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
156
176
  true
157
177
  else
158
178
  false
@@ -163,7 +183,7 @@ module Teleswagger
163
183
  when /\AArray<(?<inner_type>.+)>\z/
164
184
  inner_type = Regexp.last_match[:inner_type]
165
185
  value.map { |v| _deserialize(inner_type, v) }
166
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
167
187
  k_type = Regexp.last_match[:k_type]
168
188
  v_type = Regexp.last_match[:v_type]
169
189
  {}.tap do |hash|
@@ -0,0 +1,246 @@
1
+ =begin
2
+ #Telegram bot API
3
+
4
+ #This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
5
+
6
+ OpenAPI spec version: 3.6
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module Teleswagger
27
+
28
+ class EditMessageLiveLocationBody
29
+ attr_accessor :chat_id
30
+
31
+ attr_accessor :message_id
32
+
33
+ attr_accessor :inline_message_id
34
+
35
+ attr_accessor :latitude
36
+
37
+ attr_accessor :longitude
38
+
39
+ attr_accessor :reply_markup
40
+
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'chat_id' => :'chat_id',
46
+ :'message_id' => :'message_id',
47
+ :'inline_message_id' => :'inline_message_id',
48
+ :'latitude' => :'latitude',
49
+ :'longitude' => :'longitude',
50
+ :'reply_markup' => :'reply_markup'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.swagger_types
56
+ {
57
+ :'chat_id' => :'Object',
58
+ :'message_id' => :'Integer',
59
+ :'inline_message_id' => :'String',
60
+ :'latitude' => :'Float',
61
+ :'longitude' => :'Float',
62
+ :'reply_markup' => :'Object'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'chat_id')
75
+ self.chat_id = attributes[:'chat_id']
76
+ end
77
+
78
+ if attributes.has_key?(:'message_id')
79
+ self.message_id = attributes[:'message_id']
80
+ end
81
+
82
+ if attributes.has_key?(:'inline_message_id')
83
+ self.inline_message_id = attributes[:'inline_message_id']
84
+ end
85
+
86
+ if attributes.has_key?(:'latitude')
87
+ self.latitude = attributes[:'latitude']
88
+ end
89
+
90
+ if attributes.has_key?(:'longitude')
91
+ self.longitude = attributes[:'longitude']
92
+ end
93
+
94
+ if attributes.has_key?(:'reply_markup')
95
+ self.reply_markup = attributes[:'reply_markup']
96
+ end
97
+
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properies with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return false if @latitude.nil?
111
+ return false if @longitude.nil?
112
+ return true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ chat_id == o.chat_id &&
121
+ message_id == o.message_id &&
122
+ inline_message_id == o.inline_message_id &&
123
+ latitude == o.latitude &&
124
+ longitude == o.longitude &&
125
+ reply_markup == o.reply_markup
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Fixnum] Hash code
136
+ def hash
137
+ [chat_id, message_id, inline_message_id, latitude, longitude, reply_markup].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.swagger_types.each_pair do |key, type|
146
+ if type =~ /^Array<(.*)>/i
147
+ # check to ensure the input is an array given that the the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :BOOLEAN
177
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ temp_model = Teleswagger.const_get(type).new
198
+ temp_model.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ next if value.nil?
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map{ |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end