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