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