requestsproxy-rest 0.0.1

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