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