wine_shipping 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +128 -0
  4. data/Rakefile +8 -0
  5. data/docs/Authentication.md +10 -0
  6. data/docs/BillingContactInfo.md +18 -0
  7. data/docs/DeliveryContactInfo.md +17 -0
  8. data/docs/Inventory.md +20 -0
  9. data/docs/InventoryApi.md +102 -0
  10. data/docs/InventoryMovementApi.md +100 -0
  11. data/docs/InventoryStatusRequest.md +13 -0
  12. data/docs/InventoryStatusResult.md +12 -0
  13. data/docs/ItemInfo.md +10 -0
  14. data/docs/OrderOnHold.md +19 -0
  15. data/docs/OrderOnHoldItem.md +11 -0
  16. data/docs/PackageItem.md +10 -0
  17. data/docs/PurchaseOrderDetails.md +10 -0
  18. data/docs/PurchaseOrderInfo.md +24 -0
  19. data/docs/PurchaseOrderItemInfo.md +10 -0
  20. data/docs/RecipientContactInfo.md +18 -0
  21. data/docs/RequestorInfo.md +11 -0
  22. data/docs/ReturnResult.md +12 -0
  23. data/docs/ReturnSalesOrderHeader.md +31 -0
  24. data/docs/ReturnSalesOrderLine.md +13 -0
  25. data/docs/ReturnsRequest.md +16 -0
  26. data/docs/SKUApi.md +54 -0
  27. data/docs/SKUDetails.md +10 -0
  28. data/docs/SKUInfo.md +20 -0
  29. data/docs/SalesOrderApi.md +240 -0
  30. data/docs/SalesOrderCancelRequest.md +9 -0
  31. data/docs/SalesOrderDetails.md +14 -0
  32. data/docs/SalesOrderInfo.md +20 -0
  33. data/docs/ShipmentInfo.md +13 -0
  34. data/docs/TrackingApi.md +55 -0
  35. data/docs/TrackingRequest.md +9 -0
  36. data/docs/TrackingResult.md +28 -0
  37. data/docs/TransferOrderDetails.md +10 -0
  38. data/docs/TransferOrderInfo.md +17 -0
  39. data/docs/TransferOrderItemInfo.md +10 -0
  40. data/docs/WarehouseInventoryStatus.md +19 -0
  41. data/git_push.sh +55 -0
  42. data/lib/.DS_Store +0 -0
  43. data/lib/wine_shipping.rb +75 -0
  44. data/lib/wine_shipping/api/inventory_api.rb +127 -0
  45. data/lib/wine_shipping/api/inventory_movement_api.rb +125 -0
  46. data/lib/wine_shipping/api/sales_order_api.rb +280 -0
  47. data/lib/wine_shipping/api/sku_api.rb +74 -0
  48. data/lib/wine_shipping/api/tracking_api.rb +75 -0
  49. data/lib/wine_shipping/api_client.rb +388 -0
  50. data/lib/wine_shipping/api_error.rb +38 -0
  51. data/lib/wine_shipping/configuration.rb +202 -0
  52. data/lib/wine_shipping/models/authentication.rb +201 -0
  53. data/lib/wine_shipping/models/billing_contact_info.rb +273 -0
  54. data/lib/wine_shipping/models/delivery_contact_info.rb +298 -0
  55. data/lib/wine_shipping/models/inventory.rb +291 -0
  56. data/lib/wine_shipping/models/inventory_status_request.rb +230 -0
  57. data/lib/wine_shipping/models/inventory_status_result.rb +221 -0
  58. data/lib/wine_shipping/models/item_info.rb +201 -0
  59. data/lib/wine_shipping/models/order_on_hold.rb +284 -0
  60. data/lib/wine_shipping/models/order_on_hold_item.rb +210 -0
  61. data/lib/wine_shipping/models/package_item.rb +201 -0
  62. data/lib/wine_shipping/models/purchase_order_details.rb +203 -0
  63. data/lib/wine_shipping/models/purchase_order_info.rb +361 -0
  64. data/lib/wine_shipping/models/purchase_order_item_info.rb +201 -0
  65. data/lib/wine_shipping/models/recipient_contact_info.rb +273 -0
  66. data/lib/wine_shipping/models/requestor_info.rb +210 -0
  67. data/lib/wine_shipping/models/return_result.rb +221 -0
  68. data/lib/wine_shipping/models/return_sales_order_header.rb +392 -0
  69. data/lib/wine_shipping/models/return_sales_order_line.rb +228 -0
  70. data/lib/wine_shipping/models/returns_request.rb +257 -0
  71. data/lib/wine_shipping/models/sales_order_cancel_request.rb +192 -0
  72. data/lib/wine_shipping/models/sales_order_details.rb +239 -0
  73. data/lib/wine_shipping/models/sales_order_info.rb +325 -0
  74. data/lib/wine_shipping/models/shipment_info.rb +274 -0
  75. data/lib/wine_shipping/models/sku_details.rb +201 -0
  76. data/lib/wine_shipping/models/sku_info.rb +325 -0
  77. data/lib/wine_shipping/models/tracking_request.rb +192 -0
  78. data/lib/wine_shipping/models/tracking_result.rb +365 -0
  79. data/lib/wine_shipping/models/transfer_order_details.rb +203 -0
  80. data/lib/wine_shipping/models/transfer_order_info.rb +264 -0
  81. data/lib/wine_shipping/models/transfer_order_item_info.rb +201 -0
  82. data/lib/wine_shipping/models/warehouse_inventory_status.rb +282 -0
  83. data/lib/wine_shipping/version.rb +15 -0
  84. data/spec/api/inventory_api_spec.rb +57 -0
  85. data/spec/api/inventory_movement_api_spec.rb +57 -0
  86. data/spec/api/sales_order_api_spec.rb +90 -0
  87. data/spec/api/sku_api_spec.rb +46 -0
  88. data/spec/api/tracking_api_spec.rb +46 -0
  89. data/spec/api_client_spec.rb +226 -0
  90. data/spec/configuration_spec.rb +42 -0
  91. data/spec/models/authentication_spec.rb +53 -0
  92. data/spec/models/billing_contact_info_spec.rb +101 -0
  93. data/spec/models/delivery_contact_info_spec.rb +99 -0
  94. data/spec/models/inventory_spec.rb +113 -0
  95. data/spec/models/inventory_status_request_spec.rb +71 -0
  96. data/spec/models/inventory_status_result_spec.rb +65 -0
  97. data/spec/models/item_info_spec.rb +53 -0
  98. data/spec/models/order_on_hold_item_spec.rb +59 -0
  99. data/spec/models/order_on_hold_spec.rb +107 -0
  100. data/spec/models/package_item_spec.rb +53 -0
  101. data/spec/models/purchase_order_details_spec.rb +53 -0
  102. data/spec/models/purchase_order_info_spec.rb +141 -0
  103. data/spec/models/purchase_order_item_info_spec.rb +53 -0
  104. data/spec/models/recipient_contact_info_spec.rb +101 -0
  105. data/spec/models/requestor_info_spec.rb +59 -0
  106. data/spec/models/return_result_spec.rb +65 -0
  107. data/spec/models/return_sales_order_header_spec.rb +179 -0
  108. data/spec/models/return_sales_order_line_spec.rb +71 -0
  109. data/spec/models/returns_request_spec.rb +89 -0
  110. data/spec/models/sales_order_cancel_request_spec.rb +47 -0
  111. data/spec/models/sales_order_details_spec.rb +77 -0
  112. data/spec/models/sales_order_info_spec.rb +117 -0
  113. data/spec/models/shipment_info_spec.rb +79 -0
  114. data/spec/models/sku_details_spec.rb +53 -0
  115. data/spec/models/sku_info_spec.rb +117 -0
  116. data/spec/models/tracking_request_spec.rb +47 -0
  117. data/spec/models/tracking_result_spec.rb +161 -0
  118. data/spec/models/transfer_order_details_spec.rb +53 -0
  119. data/spec/models/transfer_order_info_spec.rb +95 -0
  120. data/spec/models/transfer_order_item_info_spec.rb +53 -0
  121. data/spec/models/warehouse_inventory_status_spec.rb +107 -0
  122. data/spec/spec_helper.rb +111 -0
  123. data/wine_shipping.gemspec +45 -0
  124. metadata +390 -0
@@ -0,0 +1,38 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ module WineShipping
14
+ class ApiError < StandardError
15
+ attr_reader :code, :response_headers, :response_body
16
+
17
+ # Usage examples:
18
+ # ApiError.new
19
+ # ApiError.new("message")
20
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
21
+ # ApiError.new(:code => 404, :message => "Not Found")
22
+ def initialize(arg = nil)
23
+ if arg.is_a? Hash
24
+ if arg.key?(:message) || arg.key?('message')
25
+ super(arg[:message] || arg['message'])
26
+ else
27
+ super arg
28
+ end
29
+
30
+ arg.each do |k, v|
31
+ instance_variable_set "@#{k}", v
32
+ end
33
+ else
34
+ super arg
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module WineShipping
16
+ class Configuration
17
+ # Defines url scheme
18
+ attr_accessor :scheme
19
+
20
+ # Defines url host
21
+ attr_accessor :host
22
+
23
+ # Defines url base path
24
+ attr_accessor :base_path
25
+
26
+ # Defines API keys used with API Key authentications.
27
+ #
28
+ # @return [Hash] key: parameter name, value: parameter value (API key)
29
+ #
30
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
31
+ # config.api_key['api_key'] = 'xxx'
32
+ attr_accessor :api_key
33
+
34
+ # Defines API key prefixes used with API Key authentications.
35
+ #
36
+ # @return [Hash] key: parameter name, value: API key prefix
37
+ #
38
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
39
+ # config.api_key_prefix['api_key'] = 'Token'
40
+ attr_accessor :api_key_prefix
41
+
42
+ # Defines the username used with HTTP basic authentication.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :username
46
+
47
+ # Defines the password used with HTTP basic authentication.
48
+ #
49
+ # @return [String]
50
+ attr_accessor :password
51
+
52
+ # Defines the access token (Bearer) used with OAuth2.
53
+ attr_accessor :access_token
54
+
55
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
56
+ # details will be logged with `logger.debug` (see the `logger` attribute).
57
+ # Default to false.
58
+ #
59
+ # @return [true, false]
60
+ attr_accessor :debugging
61
+
62
+ # Defines the logger used for debugging.
63
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
64
+ #
65
+ # @return [#debug]
66
+ attr_accessor :logger
67
+
68
+ # Defines the temporary folder to store downloaded files
69
+ # (for API endpoints that have file response).
70
+ # Default to use `Tempfile`.
71
+ #
72
+ # @return [String]
73
+ attr_accessor :temp_folder_path
74
+
75
+ # The time limit for HTTP request in seconds.
76
+ # Default to 0 (never times out).
77
+ attr_accessor :timeout
78
+
79
+ # Set this to false to skip client side validation in the operation.
80
+ # Default to true.
81
+ # @return [true, false]
82
+ attr_accessor :client_side_validation
83
+
84
+ ### TLS/SSL setting
85
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
86
+ # Default to true.
87
+ #
88
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
89
+ #
90
+ # @return [true, false]
91
+ attr_accessor :verify_ssl
92
+
93
+ ### TLS/SSL setting
94
+ # Set this to false to skip verifying SSL host name
95
+ # Default to true.
96
+ #
97
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
98
+ #
99
+ # @return [true, false]
100
+ attr_accessor :verify_ssl_host
101
+
102
+ ### TLS/SSL setting
103
+ # Set this to customize the certificate file to verify the peer.
104
+ #
105
+ # @return [String] the path to the certificate file
106
+ #
107
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
108
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
109
+ attr_accessor :ssl_ca_cert
110
+
111
+ ### TLS/SSL setting
112
+ # Client certificate file (for client certificate)
113
+ attr_accessor :cert_file
114
+
115
+ ### TLS/SSL setting
116
+ # Client private key file (for client certificate)
117
+ attr_accessor :key_file
118
+
119
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
120
+ # Default to nil.
121
+ #
122
+ # @see The params_encoding option of Ethon. Related source code:
123
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
124
+ attr_accessor :params_encoding
125
+
126
+ attr_accessor :inject_format
127
+
128
+ attr_accessor :force_ending_format
129
+
130
+ def initialize
131
+ @scheme = 'https'
132
+ @host = 'wsservices-test.azurewebsites.net'
133
+ @base_path = ''
134
+ @api_key = {}
135
+ @api_key_prefix = {}
136
+ @timeout = 0
137
+ @client_side_validation = true
138
+ @verify_ssl = true
139
+ @verify_ssl_host = true
140
+ @params_encoding = nil
141
+ @cert_file = nil
142
+ @key_file = nil
143
+ @debugging = false
144
+ @inject_format = false
145
+ @force_ending_format = false
146
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
147
+
148
+ yield(self) if block_given?
149
+ end
150
+
151
+ # The default Configuration object.
152
+ def self.default
153
+ @@default ||= Configuration.new
154
+ end
155
+
156
+ def configure
157
+ yield(self) if block_given?
158
+ end
159
+
160
+ def scheme=(scheme)
161
+ # remove :// from scheme
162
+ @scheme = scheme.sub(/:\/\//, '')
163
+ end
164
+
165
+ def host=(host)
166
+ # remove http(s):// and anything after a slash
167
+ @host = host.sub(/https?:\/\//, '').split('/').first
168
+ end
169
+
170
+ def base_path=(base_path)
171
+ # Add leading and trailing slashes to base_path
172
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
173
+ @base_path = '' if @base_path == '/'
174
+ end
175
+
176
+ def base_url
177
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
+ URI.encode(url)
179
+ end
180
+
181
+ # Gets API key (with prefix if set).
182
+ # @param [String] param_name the parameter name of API key auth
183
+ def api_key_with_prefix(param_name)
184
+ if @api_key_prefix[param_name]
185
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
186
+ else
187
+ @api_key[param_name]
188
+ end
189
+ end
190
+
191
+ # Gets Basic Auth token string
192
+ def basic_auth_token
193
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
194
+ end
195
+
196
+ # Returns Auth Settings hash for api client.
197
+ def auth_settings
198
+ {
199
+ }
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,201 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module WineShipping
16
+ class Authentication
17
+ attr_accessor :user_key
18
+
19
+ attr_accessor :password
20
+
21
+ attr_accessor :customer_no
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'user_key' => :'UserKey',
27
+ :'password' => :'Password',
28
+ :'customer_no' => :'CustomerNo'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'user_key' => :'String',
36
+ :'password' => :'String',
37
+ :'customer_no' => :'String'
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?(:'UserKey')
50
+ self.user_key = attributes[:'UserKey']
51
+ end
52
+
53
+ if attributes.has_key?(:'Password')
54
+ self.password = attributes[:'Password']
55
+ end
56
+
57
+ if attributes.has_key?(:'CustomerNo')
58
+ self.customer_no = attributes[:'CustomerNo']
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
+ user_key == o.user_key &&
81
+ password == o.password &&
82
+ customer_no == o.customer_no
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
+ [user_key, password, customer_no].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 = WineShipping.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,273 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module WineShipping
16
+ class BillingContactInfo
17
+ attr_accessor :first_name
18
+
19
+ attr_accessor :last_name
20
+
21
+ attr_accessor :company
22
+
23
+ attr_accessor :address
24
+
25
+ attr_accessor :address2
26
+
27
+ attr_accessor :city
28
+
29
+ attr_accessor :state
30
+
31
+ attr_accessor :zip_code
32
+
33
+ attr_accessor :country
34
+
35
+ attr_accessor :phone_number
36
+
37
+ attr_accessor :email_address
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'first_name' => :'FirstName',
43
+ :'last_name' => :'LastName',
44
+ :'company' => :'Company',
45
+ :'address' => :'Address',
46
+ :'address2' => :'Address2',
47
+ :'city' => :'City',
48
+ :'state' => :'State',
49
+ :'zip_code' => :'ZipCode',
50
+ :'country' => :'Country',
51
+ :'phone_number' => :'PhoneNumber',
52
+ :'email_address' => :'EmailAddress'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'first_name' => :'String',
60
+ :'last_name' => :'String',
61
+ :'company' => :'String',
62
+ :'address' => :'String',
63
+ :'address2' => :'String',
64
+ :'city' => :'String',
65
+ :'state' => :'String',
66
+ :'zip_code' => :'String',
67
+ :'country' => :'String',
68
+ :'phone_number' => :'String',
69
+ :'email_address' => :'String'
70
+ }
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ return unless attributes.is_a?(Hash)
77
+
78
+ # convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
80
+
81
+ if attributes.has_key?(:'FirstName')
82
+ self.first_name = attributes[:'FirstName']
83
+ end
84
+
85
+ if attributes.has_key?(:'LastName')
86
+ self.last_name = attributes[:'LastName']
87
+ end
88
+
89
+ if attributes.has_key?(:'Company')
90
+ self.company = attributes[:'Company']
91
+ end
92
+
93
+ if attributes.has_key?(:'Address')
94
+ self.address = attributes[:'Address']
95
+ end
96
+
97
+ if attributes.has_key?(:'Address2')
98
+ self.address2 = attributes[:'Address2']
99
+ end
100
+
101
+ if attributes.has_key?(:'City')
102
+ self.city = attributes[:'City']
103
+ end
104
+
105
+ if attributes.has_key?(:'State')
106
+ self.state = attributes[:'State']
107
+ end
108
+
109
+ if attributes.has_key?(:'ZipCode')
110
+ self.zip_code = attributes[:'ZipCode']
111
+ end
112
+
113
+ if attributes.has_key?(:'Country')
114
+ self.country = attributes[:'Country']
115
+ end
116
+
117
+ if attributes.has_key?(:'PhoneNumber')
118
+ self.phone_number = attributes[:'PhoneNumber']
119
+ end
120
+
121
+ if attributes.has_key?(:'EmailAddress')
122
+ self.email_address = attributes[:'EmailAddress']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ invalid_properties = Array.new
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ first_name == o.first_name &&
145
+ last_name == o.last_name &&
146
+ company == o.company &&
147
+ address == o.address &&
148
+ address2 == o.address2 &&
149
+ city == o.city &&
150
+ state == o.state &&
151
+ zip_code == o.zip_code &&
152
+ country == o.country &&
153
+ phone_number == o.phone_number &&
154
+ email_address == o.email_address
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Fixnum] Hash code
165
+ def hash
166
+ [first_name, last_name, company, address, address2, city, state, zip_code, country, phone_number, email_address].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.swagger_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :BOOLEAN
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ temp_model = WineShipping.const_get(type).new
227
+ temp_model.build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ next if value.nil?
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+ end
273
+ end