teleswagger 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
 
@@ -37,7 +48,7 @@ module Teleswagger
37
48
  # Attribute type mapping.
38
49
  def self.swagger_types
39
50
  {
40
- :'result' => :'GameHighScore',
51
+ :'result' => :'StickerSet',
41
52
  :'error_code' => :'Integer',
42
53
  :'ok' => :'BOOLEAN',
43
54
  :'description' => :'String'
@@ -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
 
@@ -37,7 +48,7 @@ module Teleswagger
37
48
  # Attribute type mapping.
38
49
  def self.swagger_types
39
50
  {
40
- :'result' => :'StickerSet',
51
+ :'result' => :'UserProfilePhotos',
41
52
  :'error_code' => :'Integer',
42
53
  :'ok' => :'BOOLEAN',
43
54
  :'description' => :'String'
@@ -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
 
@@ -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
 
@@ -66,14 +77,6 @@ module Teleswagger
66
77
  # @return Array for valid properies with the reasons
67
78
  def list_invalid_properties
68
79
  invalid_properties = Array.new
69
- if @phone_number.nil?
70
- invalid_properties.push("invalid value for 'phone_number', phone_number cannot be nil.")
71
- end
72
-
73
- if @first_name.nil?
74
- invalid_properties.push("invalid value for 'first_name', first_name cannot be nil.")
75
- end
76
-
77
80
  return invalid_properties
78
81
  end
79
82
 
@@ -113,7 +116,7 @@ module Teleswagger
113
116
  def build_from_hash(attributes)
114
117
  return nil unless attributes.is_a?(Hash)
115
118
  self.class.swagger_types.each_pair do |key, type|
116
- if type =~ /\AArray<(.*)>/i
119
+ if type =~ /^Array<(.*)>/i
117
120
  # check to ensure the input is an array given that the the attribute
118
121
  # is documented as an array but the input is not
119
122
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -144,7 +147,7 @@ module Teleswagger
144
147
  when :Float
145
148
  value.to_f
146
149
  when :BOOLEAN
147
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
148
151
  true
149
152
  else
150
153
  false
@@ -155,7 +158,7 @@ module Teleswagger
155
158
  when /\AArray<(?<inner_type>.+)>\z/
156
159
  inner_type = Regexp.last_match[:inner_type]
157
160
  value.map { |v| _deserialize(inner_type, v) }
158
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
159
162
  k_type = Regexp.last_match[:k_type]
160
163
  v_type = Regexp.last_match[:v_type]
161
164
  {}.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
 
@@ -19,12 +30,15 @@ module Teleswagger
19
30
 
20
31
  attr_accessor :longitude
21
32
 
33
+ attr_accessor :live_period
34
+
22
35
 
23
36
  # Attribute mapping from ruby-style variable name to JSON key.
24
37
  def self.attribute_map
25
38
  {
26
39
  :'latitude' => :'latitude',
27
- :'longitude' => :'longitude'
40
+ :'longitude' => :'longitude',
41
+ :'live_period' => :'live_period'
28
42
  }
29
43
  end
30
44
 
@@ -32,7 +46,8 @@ module Teleswagger
32
46
  def self.swagger_types
33
47
  {
34
48
  :'latitude' => :'Float',
35
- :'longitude' => :'Float'
49
+ :'longitude' => :'Float',
50
+ :'live_period' => :'Integer'
36
51
  }
37
52
  end
38
53
 
@@ -52,18 +67,23 @@ module Teleswagger
52
67
  self.longitude = attributes[:'longitude']
53
68
  end
54
69
 
70
+ if attributes.has_key?(:'live_period')
71
+ self.live_period = attributes[:'live_period']
72
+ end
73
+
55
74
  end
56
75
 
57
76
  # Show invalid properties with the reasons. Usually used together with valid?
58
77
  # @return Array for valid properies with the reasons
59
78
  def list_invalid_properties
60
79
  invalid_properties = Array.new
61
- if @latitude.nil?
62
- invalid_properties.push("invalid value for 'latitude', latitude cannot be nil.")
80
+
81
+ if !@live_period.nil? && @live_period > 86400.0
82
+ invalid_properties.push("invalid value for 'live_period', must be smaller than or equal to 86400.0.")
63
83
  end
64
84
 
65
- if @longitude.nil?
66
- invalid_properties.push("invalid value for 'longitude', longitude cannot be nil.")
85
+ if !@live_period.nil? && @live_period < 60.0
86
+ invalid_properties.push("invalid value for 'live_period', must be greater than or equal to 60.0.")
67
87
  end
68
88
 
69
89
  return invalid_properties
@@ -74,16 +94,34 @@ module Teleswagger
74
94
  def valid?
75
95
  return false if @latitude.nil?
76
96
  return false if @longitude.nil?
97
+ return false if !@live_period.nil? && @live_period > 86400.0
98
+ return false if !@live_period.nil? && @live_period < 60.0
77
99
  return true
78
100
  end
79
101
 
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] live_period Value to be assigned
104
+ def live_period=(live_period)
105
+
106
+ if !live_period.nil? && live_period > 86400.0
107
+ fail ArgumentError, "invalid value for 'live_period', must be smaller than or equal to 86400.0."
108
+ end
109
+
110
+ if !live_period.nil? && live_period < 60.0
111
+ fail ArgumentError, "invalid value for 'live_period', must be greater than or equal to 60.0."
112
+ end
113
+
114
+ @live_period = live_period
115
+ end
116
+
80
117
  # Checks equality by comparing each attribute.
81
118
  # @param [Object] Object to be compared
82
119
  def ==(o)
83
120
  return true if self.equal?(o)
84
121
  self.class == o.class &&
85
122
  latitude == o.latitude &&
86
- longitude == o.longitude
123
+ longitude == o.longitude &&
124
+ live_period == o.live_period
87
125
  end
88
126
 
89
127
  # @see the `==` method
@@ -95,7 +133,7 @@ module Teleswagger
95
133
  # Calculates hash code according to all attributes.
96
134
  # @return [Fixnum] Hash code
97
135
  def hash
98
- [latitude, longitude].hash
136
+ [latitude, longitude, live_period].hash
99
137
  end
100
138
 
101
139
  # Builds the object from hash
@@ -104,7 +142,7 @@ module Teleswagger
104
142
  def build_from_hash(attributes)
105
143
  return nil unless attributes.is_a?(Hash)
106
144
  self.class.swagger_types.each_pair do |key, type|
107
- if type =~ /\AArray<(.*)>/i
145
+ if type =~ /^Array<(.*)>/i
108
146
  # check to ensure the input is an array given that the the attribute
109
147
  # is documented as an array but the input is not
110
148
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -135,7 +173,7 @@ module Teleswagger
135
173
  when :Float
136
174
  value.to_f
137
175
  when :BOOLEAN
138
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
139
177
  true
140
178
  else
141
179
  false
@@ -146,7 +184,7 @@ module Teleswagger
146
184
  when /\AArray<(?<inner_type>.+)>\z/
147
185
  inner_type = Regexp.last_match[:inner_type]
148
186
  value.map { |v| _deserialize(inner_type, v) }
149
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
150
188
  k_type = Regexp.last_match[:k_type]
151
189
  v_type = Regexp.last_match[:v_type]
152
190
  {}.tap do |hash|
@@ -0,0 +1,228 @@
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 InputMediaPhoto
29
+ attr_accessor :type
30
+
31
+ attr_accessor :media
32
+
33
+ attr_accessor :caption
34
+
35
+ attr_accessor :parse_mode
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'type' => :'type',
42
+ :'media' => :'media',
43
+ :'caption' => :'caption',
44
+ :'parse_mode' => :'parse_mode'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'type' => :'String',
52
+ :'media' => :'String',
53
+ :'caption' => :'String',
54
+ :'parse_mode' => :'ParseMode'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'type')
67
+ self.type = attributes[:'type']
68
+ end
69
+
70
+ if attributes.has_key?(:'media')
71
+ self.media = attributes[:'media']
72
+ end
73
+
74
+ if attributes.has_key?(:'caption')
75
+ self.caption = attributes[:'caption']
76
+ end
77
+
78
+ if attributes.has_key?(:'parse_mode')
79
+ self.parse_mode = attributes[:'parse_mode']
80
+ end
81
+
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properies with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ return invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return false if @type.nil?
95
+ return false if @media.nil?
96
+ return true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ type == o.type &&
105
+ media == o.media &&
106
+ caption == o.caption &&
107
+ parse_mode == o.parse_mode
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Fixnum] Hash code
118
+ def hash
119
+ [type, media, caption, parse_mode].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.swagger_types.each_pair do |key, type|
128
+ if type =~ /^Array<(.*)>/i
129
+ # check to ensure the input is an array given that the the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :BOOLEAN
159
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ temp_model = Teleswagger.const_get(type).new
180
+ temp_model.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map{ |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end