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