requestsproxy-rest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +149 -0
- data/Rakefile +8 -0
- data/docs/ProtobufListValue.md +8 -0
- data/docs/ProtobufNullValue.md +7 -0
- data/docs/ProtobufStruct.md +8 -0
- data/docs/ProtobufValue.md +13 -0
- data/docs/RequestsproxyAccountStarRatingResponse.md +9 -0
- data/docs/RequestsproxyApi.md +1008 -0
- data/docs/RequestsproxyAuthInfoResponse.md +9 -0
- data/docs/RequestsproxyCategory.md +9 -0
- data/docs/RequestsproxyComment.md +11 -0
- data/docs/RequestsproxyCoupon.md +8 -0
- data/docs/RequestsproxyCreateDynamicCouponsCodesResponse.md +9 -0
- data/docs/RequestsproxyCreateWebhookParams.md +9 -0
- data/docs/RequestsproxyDynamicCouponError.md +9 -0
- data/docs/RequestsproxyDynamicCouponsResponse.md +8 -0
- data/docs/RequestsproxyDynamicCouponsStatisticsResponse.md +8 -0
- data/docs/RequestsproxyDynamicCouponsStats.md +9 -0
- data/docs/RequestsproxyFeature.md +12 -0
- data/docs/RequestsproxyFeaturesResponse.md +8 -0
- data/docs/RequestsproxyImageData.md +10 -0
- data/docs/RequestsproxyOrdersResponse.md +8 -0
- data/docs/RequestsproxyPagination.md +10 -0
- data/docs/RequestsproxyProductImage.md +11 -0
- data/docs/RequestsproxyProductResponse.md +19 -0
- data/docs/RequestsproxyProductSpecs.md +9 -0
- data/docs/RequestsproxyProductStarRatingResponse.md +10 -0
- data/docs/RequestsproxyProductsResponse.md +8 -0
- data/docs/RequestsproxyProductsStarRatingResponse.md +8 -0
- data/docs/RequestsproxyPromotedProduct.md +10 -0
- data/docs/RequestsproxyPromotedProductsResponse.md +8 -0
- data/docs/RequestsproxyPurchase.md +16 -0
- data/docs/RequestsproxyResponse.md +28 -0
- data/docs/RequestsproxyReview.md +24 -0
- data/docs/RequestsproxyReviewCustomField.md +11 -0
- data/docs/RequestsproxyReviewResponse.md +8 -0
- data/docs/RequestsproxyReviewsResponse.md +8 -0
- data/docs/RequestsproxyStatus.md +9 -0
- data/docs/RequestsproxyTopReview.md +13 -0
- data/docs/RequestsproxyTopReviewsResponse.md +8 -0
- data/docs/RequestsproxyUserResponse.md +11 -0
- data/docs/RequestsproxyWebhook.md +11 -0
- data/docs/RequestsproxyWebhookEvent.md +9 -0
- data/docs/RequestsproxyWebhookEventsResponse.md +8 -0
- data/docs/RequestsproxyWebhookResponse.md +8 -0
- data/docs/RequestsproxyWebhooksResponse.md +8 -0
- data/git_push.sh +55 -0
- data/lib/requestsproxy-rest.rb +83 -0
- data/lib/requestsproxy-rest/api/requestsproxy_api.rb +1161 -0
- data/lib/requestsproxy-rest/api_client.rb +388 -0
- data/lib/requestsproxy-rest/api_error.rb +38 -0
- data/lib/requestsproxy-rest/configuration.rb +202 -0
- data/lib/requestsproxy-rest/models/protobuf_list_value.rb +187 -0
- data/lib/requestsproxy-rest/models/protobuf_null_value.rb +29 -0
- data/lib/requestsproxy-rest/models/protobuf_struct.rb +187 -0
- data/lib/requestsproxy-rest/models/protobuf_value.rb +235 -0
- data/lib/requestsproxy-rest/models/requestsproxy_account_star_rating_response.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_auth_info_response.rb +194 -0
- data/lib/requestsproxy-rest/models/requestsproxy_category.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_comment.rb +210 -0
- data/lib/requestsproxy-rest/models/requestsproxy_coupon.rb +183 -0
- data/lib/requestsproxy-rest/models/requestsproxy_create_dynamic_coupons_codes_response.rb +194 -0
- data/lib/requestsproxy-rest/models/requestsproxy_create_webhook_params.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_dynamic_coupon_error.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_dynamic_coupons_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_dynamic_coupons_statistics_response.rb +183 -0
- data/lib/requestsproxy-rest/models/requestsproxy_dynamic_coupons_stats.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_feature.rb +219 -0
- data/lib/requestsproxy-rest/models/requestsproxy_features_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_image_data.rb +201 -0
- data/lib/requestsproxy-rest/models/requestsproxy_orders_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_pagination.rb +201 -0
- data/lib/requestsproxy-rest/models/requestsproxy_product_image.rb +210 -0
- data/lib/requestsproxy-rest/models/requestsproxy_product_response.rb +286 -0
- data/lib/requestsproxy-rest/models/requestsproxy_product_specs.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_product_star_rating_response.rb +201 -0
- data/lib/requestsproxy-rest/models/requestsproxy_products_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_products_star_rating_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_promoted_product.rb +201 -0
- data/lib/requestsproxy-rest/models/requestsproxy_promoted_products_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_purchase.rb +255 -0
- data/lib/requestsproxy-rest/models/requestsproxy_response.rb +363 -0
- data/lib/requestsproxy-rest/models/requestsproxy_review.rb +331 -0
- data/lib/requestsproxy-rest/models/requestsproxy_review_custom_field.rb +210 -0
- data/lib/requestsproxy-rest/models/requestsproxy_review_response.rb +183 -0
- data/lib/requestsproxy-rest/models/requestsproxy_reviews_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_status.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_top_review.rb +228 -0
- data/lib/requestsproxy-rest/models/requestsproxy_top_reviews_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_user_response.rb +210 -0
- data/lib/requestsproxy-rest/models/requestsproxy_webhook.rb +210 -0
- data/lib/requestsproxy-rest/models/requestsproxy_webhook_event.rb +192 -0
- data/lib/requestsproxy-rest/models/requestsproxy_webhook_events_response.rb +185 -0
- data/lib/requestsproxy-rest/models/requestsproxy_webhook_response.rb +183 -0
- data/lib/requestsproxy-rest/models/requestsproxy_webhooks_response.rb +185 -0
- data/lib/requestsproxy-rest/version.rb +15 -0
- data/requestsproxy-rest.gemspec +45 -0
- data/spec/api/requestsproxy_api_spec.rb +271 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/protobuf_list_value_spec.rb +41 -0
- data/spec/models/protobuf_null_value_spec.rb +35 -0
- data/spec/models/protobuf_struct_spec.rb +41 -0
- data/spec/models/protobuf_value_spec.rb +71 -0
- data/spec/models/requestsproxy_account_star_rating_response_spec.rb +47 -0
- data/spec/models/requestsproxy_auth_info_response_spec.rb +47 -0
- data/spec/models/requestsproxy_category_spec.rb +47 -0
- data/spec/models/requestsproxy_comment_spec.rb +59 -0
- data/spec/models/requestsproxy_coupon_spec.rb +41 -0
- data/spec/models/requestsproxy_create_dynamic_coupons_codes_response_spec.rb +47 -0
- data/spec/models/requestsproxy_create_webhook_params_spec.rb +47 -0
- data/spec/models/requestsproxy_dynamic_coupon_error_spec.rb +47 -0
- data/spec/models/requestsproxy_dynamic_coupons_response_spec.rb +41 -0
- data/spec/models/requestsproxy_dynamic_coupons_statistics_response_spec.rb +41 -0
- data/spec/models/requestsproxy_dynamic_coupons_stats_spec.rb +47 -0
- data/spec/models/requestsproxy_feature_spec.rb +65 -0
- data/spec/models/requestsproxy_features_response_spec.rb +41 -0
- data/spec/models/requestsproxy_image_data_spec.rb +53 -0
- data/spec/models/requestsproxy_orders_response_spec.rb +41 -0
- data/spec/models/requestsproxy_pagination_spec.rb +53 -0
- data/spec/models/requestsproxy_product_image_spec.rb +59 -0
- data/spec/models/requestsproxy_product_response_spec.rb +107 -0
- data/spec/models/requestsproxy_product_specs_spec.rb +47 -0
- data/spec/models/requestsproxy_product_star_rating_response_spec.rb +53 -0
- data/spec/models/requestsproxy_products_response_spec.rb +41 -0
- data/spec/models/requestsproxy_products_star_rating_response_spec.rb +41 -0
- data/spec/models/requestsproxy_promoted_product_spec.rb +53 -0
- data/spec/models/requestsproxy_promoted_products_response_spec.rb +41 -0
- data/spec/models/requestsproxy_purchase_spec.rb +89 -0
- data/spec/models/requestsproxy_response_spec.rb +161 -0
- data/spec/models/requestsproxy_review_custom_field_spec.rb +59 -0
- data/spec/models/requestsproxy_review_response_spec.rb +41 -0
- data/spec/models/requestsproxy_review_spec.rb +137 -0
- data/spec/models/requestsproxy_reviews_response_spec.rb +41 -0
- data/spec/models/requestsproxy_status_spec.rb +47 -0
- data/spec/models/requestsproxy_top_review_spec.rb +71 -0
- data/spec/models/requestsproxy_top_reviews_response_spec.rb +41 -0
- data/spec/models/requestsproxy_user_response_spec.rb +59 -0
- data/spec/models/requestsproxy_webhook_event_spec.rb +47 -0
- data/spec/models/requestsproxy_webhook_events_response_spec.rb +41 -0
- data/spec/models/requestsproxy_webhook_response_spec.rb +41 -0
- data/spec/models/requestsproxy_webhook_spec.rb +59 -0
- data/spec/models/requestsproxy_webhooks_response_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +416 -0
@@ -0,0 +1,331 @@
|
|
1
|
+
=begin
|
2
|
+
#requestsproxy.proto
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: version not set
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Requestsproxy
|
16
|
+
class RequestsproxyReview
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
attr_accessor :score
|
20
|
+
|
21
|
+
attr_accessor :votes_up
|
22
|
+
|
23
|
+
attr_accessor :votes_down
|
24
|
+
|
25
|
+
attr_accessor :content
|
26
|
+
|
27
|
+
attr_accessor :title
|
28
|
+
|
29
|
+
attr_accessor :created_at
|
30
|
+
|
31
|
+
attr_accessor :verified_buyer
|
32
|
+
|
33
|
+
attr_accessor :source_review_id
|
34
|
+
|
35
|
+
attr_accessor :custom_fields
|
36
|
+
|
37
|
+
attr_accessor :images_data
|
38
|
+
|
39
|
+
attr_accessor :user
|
40
|
+
|
41
|
+
attr_accessor :product
|
42
|
+
|
43
|
+
attr_accessor :user_id
|
44
|
+
|
45
|
+
attr_accessor :product_id
|
46
|
+
|
47
|
+
attr_accessor :comment
|
48
|
+
|
49
|
+
attr_accessor :external_product_id
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'id' => :'id',
|
55
|
+
:'score' => :'score',
|
56
|
+
:'votes_up' => :'votes_up',
|
57
|
+
:'votes_down' => :'votes_down',
|
58
|
+
:'content' => :'content',
|
59
|
+
:'title' => :'title',
|
60
|
+
:'created_at' => :'created_at',
|
61
|
+
:'verified_buyer' => :'verified_buyer',
|
62
|
+
:'source_review_id' => :'source_review_id',
|
63
|
+
:'custom_fields' => :'custom_fields',
|
64
|
+
:'images_data' => :'images_data',
|
65
|
+
:'user' => :'user',
|
66
|
+
:'product' => :'product',
|
67
|
+
:'user_id' => :'user_id',
|
68
|
+
:'product_id' => :'product_id',
|
69
|
+
:'comment' => :'comment',
|
70
|
+
:'external_product_id' => :'external_product_id'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attribute type mapping.
|
75
|
+
def self.swagger_types
|
76
|
+
{
|
77
|
+
:'id' => :'String',
|
78
|
+
:'score' => :'Integer',
|
79
|
+
:'votes_up' => :'Integer',
|
80
|
+
:'votes_down' => :'Integer',
|
81
|
+
:'content' => :'String',
|
82
|
+
:'title' => :'String',
|
83
|
+
:'created_at' => :'DateTime',
|
84
|
+
:'verified_buyer' => :'BOOLEAN',
|
85
|
+
:'source_review_id' => :'Integer',
|
86
|
+
:'custom_fields' => :'Hash<String, RequestsproxyReviewCustomField>',
|
87
|
+
:'images_data' => :'Array<RequestsproxyImageData>',
|
88
|
+
:'user' => :'RequestsproxyUserResponse',
|
89
|
+
:'product' => :'RequestsproxyProductResponse',
|
90
|
+
:'user_id' => :'Integer',
|
91
|
+
:'product_id' => :'Integer',
|
92
|
+
:'comment' => :'RequestsproxyComment',
|
93
|
+
:'external_product_id' => :'String'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
# Initializes the object
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
def initialize(attributes = {})
|
100
|
+
return unless attributes.is_a?(Hash)
|
101
|
+
|
102
|
+
# convert string to symbol for hash key
|
103
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
104
|
+
|
105
|
+
if attributes.has_key?(:'id')
|
106
|
+
self.id = attributes[:'id']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'score')
|
110
|
+
self.score = attributes[:'score']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'votes_up')
|
114
|
+
self.votes_up = attributes[:'votes_up']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'votes_down')
|
118
|
+
self.votes_down = attributes[:'votes_down']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'content')
|
122
|
+
self.content = attributes[:'content']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'title')
|
126
|
+
self.title = attributes[:'title']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'created_at')
|
130
|
+
self.created_at = attributes[:'created_at']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'verified_buyer')
|
134
|
+
self.verified_buyer = attributes[:'verified_buyer']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'source_review_id')
|
138
|
+
self.source_review_id = attributes[:'source_review_id']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'custom_fields')
|
142
|
+
if (value = attributes[:'custom_fields']).is_a?(Hash)
|
143
|
+
self.custom_fields = value
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'images_data')
|
148
|
+
if (value = attributes[:'images_data']).is_a?(Array)
|
149
|
+
self.images_data = value
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'user')
|
154
|
+
self.user = attributes[:'user']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'product')
|
158
|
+
self.product = attributes[:'product']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'user_id')
|
162
|
+
self.user_id = attributes[:'user_id']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'product_id')
|
166
|
+
self.product_id = attributes[:'product_id']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'comment')
|
170
|
+
self.comment = attributes[:'comment']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'external_product_id')
|
174
|
+
self.external_product_id = attributes[:'external_product_id']
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
179
|
+
# @return Array for valid properties with the reasons
|
180
|
+
def list_invalid_properties
|
181
|
+
invalid_properties = Array.new
|
182
|
+
invalid_properties
|
183
|
+
end
|
184
|
+
|
185
|
+
# Check to see if the all the properties in the model are valid
|
186
|
+
# @return true if the model is valid
|
187
|
+
def valid?
|
188
|
+
true
|
189
|
+
end
|
190
|
+
|
191
|
+
# Checks equality by comparing each attribute.
|
192
|
+
# @param [Object] Object to be compared
|
193
|
+
def ==(o)
|
194
|
+
return true if self.equal?(o)
|
195
|
+
self.class == o.class &&
|
196
|
+
id == o.id &&
|
197
|
+
score == o.score &&
|
198
|
+
votes_up == o.votes_up &&
|
199
|
+
votes_down == o.votes_down &&
|
200
|
+
content == o.content &&
|
201
|
+
title == o.title &&
|
202
|
+
created_at == o.created_at &&
|
203
|
+
verified_buyer == o.verified_buyer &&
|
204
|
+
source_review_id == o.source_review_id &&
|
205
|
+
custom_fields == o.custom_fields &&
|
206
|
+
images_data == o.images_data &&
|
207
|
+
user == o.user &&
|
208
|
+
product == o.product &&
|
209
|
+
user_id == o.user_id &&
|
210
|
+
product_id == o.product_id &&
|
211
|
+
comment == o.comment &&
|
212
|
+
external_product_id == o.external_product_id
|
213
|
+
end
|
214
|
+
|
215
|
+
# @see the `==` method
|
216
|
+
# @param [Object] Object to be compared
|
217
|
+
def eql?(o)
|
218
|
+
self == o
|
219
|
+
end
|
220
|
+
|
221
|
+
# Calculates hash code according to all attributes.
|
222
|
+
# @return [Fixnum] Hash code
|
223
|
+
def hash
|
224
|
+
[id, score, votes_up, votes_down, content, title, created_at, verified_buyer, source_review_id, custom_fields, images_data, user, product, user_id, product_id, comment, external_product_id].hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Builds the object from hash
|
228
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
229
|
+
# @return [Object] Returns the model itself
|
230
|
+
def build_from_hash(attributes)
|
231
|
+
return nil unless attributes.is_a?(Hash)
|
232
|
+
self.class.swagger_types.each_pair do |key, type|
|
233
|
+
if type =~ /\AArray<(.*)>/i
|
234
|
+
# check to ensure the input is an array given that the the attribute
|
235
|
+
# is documented as an array but the input is not
|
236
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
237
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
238
|
+
end
|
239
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
240
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
241
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
242
|
+
end
|
243
|
+
|
244
|
+
self
|
245
|
+
end
|
246
|
+
|
247
|
+
# Deserializes the data based on type
|
248
|
+
# @param string type Data type
|
249
|
+
# @param string value Value to be deserialized
|
250
|
+
# @return [Object] Deserialized data
|
251
|
+
def _deserialize(type, value)
|
252
|
+
case type.to_sym
|
253
|
+
when :DateTime
|
254
|
+
DateTime.parse(value)
|
255
|
+
when :Date
|
256
|
+
Date.parse(value)
|
257
|
+
when :String
|
258
|
+
value.to_s
|
259
|
+
when :Integer
|
260
|
+
value.to_i
|
261
|
+
when :Float
|
262
|
+
value.to_f
|
263
|
+
when :BOOLEAN
|
264
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
265
|
+
true
|
266
|
+
else
|
267
|
+
false
|
268
|
+
end
|
269
|
+
when :Object
|
270
|
+
# generic object (usually a Hash), return directly
|
271
|
+
value
|
272
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
273
|
+
inner_type = Regexp.last_match[:inner_type]
|
274
|
+
value.map { |v| _deserialize(inner_type, v) }
|
275
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
276
|
+
k_type = Regexp.last_match[:k_type]
|
277
|
+
v_type = Regexp.last_match[:v_type]
|
278
|
+
{}.tap do |hash|
|
279
|
+
value.each do |k, v|
|
280
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
else # model
|
284
|
+
temp_model = Requestsproxy.const_get(type).new
|
285
|
+
temp_model.build_from_hash(value)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# Returns the string representation of the object
|
290
|
+
# @return [String] String presentation of the object
|
291
|
+
def to_s
|
292
|
+
to_hash.to_s
|
293
|
+
end
|
294
|
+
|
295
|
+
# to_body is an alias to to_hash (backward compatibility)
|
296
|
+
# @return [Hash] Returns the object in the form of hash
|
297
|
+
def to_body
|
298
|
+
to_hash
|
299
|
+
end
|
300
|
+
|
301
|
+
# Returns the object in the form of hash
|
302
|
+
# @return [Hash] Returns the object in the form of hash
|
303
|
+
def to_hash
|
304
|
+
hash = {}
|
305
|
+
self.class.attribute_map.each_pair do |attr, param|
|
306
|
+
value = self.send(attr)
|
307
|
+
next if value.nil?
|
308
|
+
hash[param] = _to_hash(value)
|
309
|
+
end
|
310
|
+
hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Outputs non-array value in the form of hash
|
314
|
+
# For object, use to_hash. Otherwise, just return the value
|
315
|
+
# @param [Object] value Any valid value
|
316
|
+
# @return [Hash] Returns the value in the form of hash
|
317
|
+
def _to_hash(value)
|
318
|
+
if value.is_a?(Array)
|
319
|
+
value.compact.map { |v| _to_hash(v) }
|
320
|
+
elsif value.is_a?(Hash)
|
321
|
+
{}.tap do |hash|
|
322
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
323
|
+
end
|
324
|
+
elsif value.respond_to? :to_hash
|
325
|
+
value.to_hash
|
326
|
+
else
|
327
|
+
value
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
=begin
|
2
|
+
#requestsproxy.proto
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: version not set
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Requestsproxy
|
16
|
+
class RequestsproxyReviewCustomField
|
17
|
+
attr_accessor :title
|
18
|
+
|
19
|
+
attr_accessor :form_id
|
20
|
+
|
21
|
+
attr_accessor :value
|
22
|
+
|
23
|
+
attr_accessor :field_type
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'title' => :'title',
|
29
|
+
:'form_id' => :'form_id',
|
30
|
+
:'value' => :'value',
|
31
|
+
:'field_type' => :'field_type'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.swagger_types
|
37
|
+
{
|
38
|
+
:'title' => :'String',
|
39
|
+
:'form_id' => :'Integer',
|
40
|
+
:'value' => :'ProtobufValue',
|
41
|
+
:'field_type' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
|
+
|
53
|
+
if attributes.has_key?(:'title')
|
54
|
+
self.title = attributes[:'title']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'form_id')
|
58
|
+
self.form_id = attributes[:'form_id']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'value')
|
62
|
+
self.value = attributes[:'value']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'field_type')
|
66
|
+
self.field_type = attributes[:'field_type']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
title == o.title &&
|
89
|
+
form_id == o.form_id &&
|
90
|
+
value == o.value &&
|
91
|
+
field_type == o.field_type
|
92
|
+
end
|
93
|
+
|
94
|
+
# @see the `==` method
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def eql?(o)
|
97
|
+
self == o
|
98
|
+
end
|
99
|
+
|
100
|
+
# Calculates hash code according to all attributes.
|
101
|
+
# @return [Fixnum] Hash code
|
102
|
+
def hash
|
103
|
+
[title, form_id, value, field_type].hash
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.swagger_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :BOOLEAN
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
temp_model = Requestsproxy.const_get(type).new
|
164
|
+
temp_model.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the string representation of the object
|
169
|
+
# @return [String] String presentation of the object
|
170
|
+
def to_s
|
171
|
+
to_hash.to_s
|
172
|
+
end
|
173
|
+
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_body
|
177
|
+
to_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the object in the form of hash
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
next if value.nil?
|
187
|
+
hash[param] = _to_hash(value)
|
188
|
+
end
|
189
|
+
hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Outputs non-array value in the form of hash
|
193
|
+
# For object, use to_hash. Otherwise, just return the value
|
194
|
+
# @param [Object] value Any valid value
|
195
|
+
# @return [Hash] Returns the value in the form of hash
|
196
|
+
def _to_hash(value)
|
197
|
+
if value.is_a?(Array)
|
198
|
+
value.compact.map { |v| _to_hash(v) }
|
199
|
+
elsif value.is_a?(Hash)
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
202
|
+
end
|
203
|
+
elsif value.respond_to? :to_hash
|
204
|
+
value.to_hash
|
205
|
+
else
|
206
|
+
value
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|