dear-inventory-ruby 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ffbd271d3c715cef93bb33ce9a2f24c53c2decb1ecd1dcdfb15efc1929caf79
4
- data.tar.gz: ba565c2f1ff6c1784d015e782bfbeb673e5540dce0120035854a4e16e939cff0
3
+ metadata.gz: 1520077f652087124545b720ac13cd528fdf40dc9985ce8b8acc5fe3ffaef322
4
+ data.tar.gz: c5887cbe8fb6152b86a25a3c754940d52e905d7c8934a9b713ab46628983860d
5
5
  SHA512:
6
- metadata.gz: b284bec84a7a1cd777cda1c0d085446f4fefb4e8244b9f8e08796291d7a4ceacb52e4fd2e00f0d636f7226f22a0952502180bfd0223b7e8230ca41ff574e4b88
7
- data.tar.gz: 9953f21dc71d78792c23c307965ff6d878e4684a075c5b9d25afbac53bdd6cc5dde695676e32a551cf7803e1c020a5d0298e90f0202d2303618c7483599c0503
6
+ metadata.gz: 6ed901fecd45e0eef5651040a5f5a6a1b5c7deaa8599f72afba5a64d24824525a3648bde1d41b6926311a3841693026ff3e03f5a4625cb39e9fdbd2b3dfdf6a4
7
+ data.tar.gz: 5dfa595e9d4c8a869e7ac7d496bf42e8e41ddde652d81ca63b3d3010413794cef202ea62738a6575fbaecfa88861aa4d53305a73ce71030480b15c3da09df4a5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.15] - 2021-02-22
6
+
7
+ - Add new endpoint GET `/sale/invoice` and some related models.
8
+
5
9
  ## [0.1.14] - 2021-05-01
6
10
 
7
11
  - Remove validation `Currency` for `Customer` and `Me` models.
data/README.md CHANGED
@@ -7,7 +7,7 @@ This specifing endpoints for DEAR Inventory API
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 0.1.14
10
+ - Package version: 0.1.15
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [https://www.nnhan.me](https://www.nnhan.me)
13
13
 
@@ -24,16 +24,16 @@ gem build dear-inventory-ruby.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./dear-inventory-ruby-0.1.14.gem
27
+ gem install ./dear-inventory-ruby-0.1.15.gem
28
28
  ```
29
29
 
30
- (for development, run `gem install --dev ./dear-inventory-ruby-0.1.14.gem` to install the development dependencies)
30
+ (for development, run `gem install --dev ./dear-inventory-ruby-0.1.15.gem` to install the development dependencies)
31
31
 
32
32
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
33
 
34
34
  Finally add this to the Gemfile:
35
35
 
36
- gem 'dear-inventory-ruby', '~> 0.1.14'
36
+ gem 'dear-inventory-ruby', '~> 0.1.15'
37
37
 
38
38
  ### Install from Git
39
39
 
@@ -103,6 +103,7 @@ Class | Method | HTTP request | Description
103
103
  *DearInventoryRuby::InventoryApi* | [**get_me**](docs/InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
104
104
  *DearInventoryRuby::InventoryApi* | [**get_payment_terms**](docs/InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
105
105
  *DearInventoryRuby::InventoryApi* | [**get_price_tiers**](docs/InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
106
+ *DearInventoryRuby::InventoryApi* | [**get_sale_invoices**](docs/InventoryApi.md#get_sale_invoices) | **GET** /sale/invoice | Allows you to retrieve the sale invoices
106
107
  *DearInventoryRuby::InventoryApi* | [**get_taxes**](docs/InventoryApi.md#get_taxes) | **GET** /ref/tax | Allows you to retrieve the taxes
107
108
  *DearInventoryRuby::InventoryApi* | [**update_account**](docs/InventoryApi.md#update_account) | **PUT** /ref/account | Allows you to update an Account
108
109
  *DearInventoryRuby::InventoryApi* | [**update_customer**](docs/InventoryApi.md#update_customer) | **PUT** /customer | Allows you to update a customer
@@ -126,6 +127,10 @@ Class | Method | HTTP request | Description
126
127
  - [DearInventoryRuby::PaymentTerms](docs/PaymentTerms.md)
127
128
  - [DearInventoryRuby::PriceTier](docs/PriceTier.md)
128
129
  - [DearInventoryRuby::PriceTiers](docs/PriceTiers.md)
130
+ - [DearInventoryRuby::SaleInvoice](docs/SaleInvoice.md)
131
+ - [DearInventoryRuby::SaleInvoiceAdditionalCharge](docs/SaleInvoiceAdditionalCharge.md)
132
+ - [DearInventoryRuby::SaleInvoiceLine](docs/SaleInvoiceLine.md)
133
+ - [DearInventoryRuby::SaleInvoices](docs/SaleInvoices.md)
129
134
  - [DearInventoryRuby::Success](docs/Success.md)
130
135
  - [DearInventoryRuby::Tax](docs/Tax.md)
131
136
  - [DearInventoryRuby::TaxComponent](docs/TaxComponent.md)
data/docs/InventoryApi.md CHANGED
@@ -15,6 +15,7 @@ Method | HTTP request | Description
15
15
  [**get_me**](InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
16
16
  [**get_payment_terms**](InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
17
17
  [**get_price_tiers**](InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
18
+ [**get_sale_invoices**](InventoryApi.md#get_sale_invoices) | **GET** /sale/invoice | Allows you to retrieve the sale invoices
18
19
  [**get_taxes**](InventoryApi.md#get_taxes) | **GET** /ref/tax | Allows you to retrieve the taxes
19
20
  [**update_account**](InventoryApi.md#update_account) | **PUT** /ref/account | Allows you to update an Account
20
21
  [**update_customer**](InventoryApi.md#update_customer) | **PUT** /customer | Allows you to update a customer
@@ -700,6 +701,69 @@ This endpoint does not need any parameter.
700
701
  - **Accept**: application/json
701
702
 
702
703
 
704
+ ## get_sale_invoices
705
+
706
+ > SaleInvoices get_sale_invoices(opts)
707
+
708
+ Allows you to retrieve the sale invoices
709
+
710
+ ### Example
711
+
712
+ ```ruby
713
+ # load the gem
714
+ require 'dear-inventory-ruby'
715
+ # setup authorization
716
+ DearInventoryRuby.configure do |config|
717
+ # Configure API key authorization: accountID
718
+ config.api_key['api-auth-accountid'] = 'YOUR API KEY'
719
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
720
+ #config.api_key_prefix['api-auth-accountid'] = 'Bearer'
721
+
722
+ # Configure API key authorization: appKey
723
+ config.api_key['api-auth-applicationkey'] = 'YOUR API KEY'
724
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
725
+ #config.api_key_prefix['api-auth-applicationkey'] = 'Bearer'
726
+ end
727
+
728
+ api_instance = DearInventoryRuby::InventoryApi.new
729
+ opts = {
730
+ sale_id: 'sale_id_example', # String | Unique DEAR Sale ID
731
+ combine_additional_charges: false, # Boolean | Show additional charges in 'Lines' array
732
+ include_product_info: false # Boolean | Show all used products in additional array
733
+ }
734
+
735
+ begin
736
+ #Allows you to retrieve the sale invoices
737
+ result = api_instance.get_sale_invoices(opts)
738
+ p result
739
+ rescue DearInventoryRuby::ApiError => e
740
+ puts "Exception when calling InventoryApi->get_sale_invoices: #{e}"
741
+ end
742
+ ```
743
+
744
+ ### Parameters
745
+
746
+
747
+ Name | Type | Description | Notes
748
+ ------------- | ------------- | ------------- | -------------
749
+ **sale_id** | **String**| Unique DEAR Sale ID | [optional]
750
+ **combine_additional_charges** | **Boolean**| Show additional charges in 'Lines' array | [optional] [default to false]
751
+ **include_product_info** | **Boolean**| Show all used products in additional array | [optional] [default to false]
752
+
753
+ ### Return type
754
+
755
+ [**SaleInvoices**](SaleInvoices.md)
756
+
757
+ ### Authorization
758
+
759
+ [accountID](../README.md#accountID), [appKey](../README.md#appKey)
760
+
761
+ ### HTTP request headers
762
+
763
+ - **Content-Type**: Not defined
764
+ - **Accept**: application/json
765
+
766
+
703
767
  ## get_taxes
704
768
 
705
769
  > Taxes get_taxes(opts)
@@ -0,0 +1,41 @@
1
+ # DearInventoryRuby::SaleInvoice
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **task_id** | **String** | Identifier of sale Invoice task |
8
+ **combine_additional_charges** | **Boolean** | if true then additional charges lines displayed in Lines array | [default to false]
9
+ **invoice_number** | **String** | Invoice Number (auto-generated) | [optional]
10
+ **memo** | **String** | Additional information for Invoice. | [optional]
11
+ **status** | **String** | Invoice status. Possible Values are values. For POST available values are DRAFT, AUTHORISED |
12
+ **invoice_date** | **String** | Invoice Date. |
13
+ **invoice_due_date** | **String** | Invoice Due Date. |
14
+ **currency_conversion_rate** | **Float** | Decimal with up to 4 decimal places | [optional]
15
+ **billing_address_line1** | **String** | Billing Address Line 1 | [optional]
16
+ **billing_address_line2** | **String** | Billing Address Line 2 | [optional]
17
+ **linked_fulfillment_number** | **Integer** | Number of Fulfilment linked to this invoice | [optional]
18
+ **lines** | [**Array<SaleInvoiceLine>**](SaleInvoiceLine.md) | | [optional]
19
+ **additional_charges** | [**Array<SaleInvoiceAdditionalCharge>**](SaleInvoiceAdditionalCharge.md) | | [optional]
20
+
21
+ ## Code Sample
22
+
23
+ ```ruby
24
+ require 'DearInventoryRuby'
25
+
26
+ instance = DearInventoryRuby::SaleInvoice.new(task_id: nil,
27
+ combine_additional_charges: nil,
28
+ invoice_number: nil,
29
+ memo: nil,
30
+ status: nil,
31
+ invoice_date: nil,
32
+ invoice_due_date: nil,
33
+ currency_conversion_rate: nil,
34
+ billing_address_line1: nil,
35
+ billing_address_line2: nil,
36
+ linked_fulfillment_number: nil,
37
+ lines: nil,
38
+ additional_charges: nil)
39
+ ```
40
+
41
+
@@ -0,0 +1,33 @@
1
+ # DearInventoryRuby::SaleInvoiceAdditionalCharge
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **description** | **String** | Name of Service Product referenced by this Line |
8
+ **quantity** | **Float** | Product or service quantity. Minimal value is 1. |
9
+ **price** | **Float** | Price per unit in Customer currency |
10
+ **discount** | **Float** | Discount. Value between 0 and 100. For free items discount is 100. Default value is 0 | [optional]
11
+ **tax** | **Float** | Tax |
12
+ **total** | **Float** | Line Total.For validation | [optional]
13
+ **tax_rule** | **Float** | Line Tax Rule name. |
14
+ **account** | **Float** | Revenue account |
15
+ **comment** | **Float** | Comment | [optional]
16
+
17
+ ## Code Sample
18
+
19
+ ```ruby
20
+ require 'DearInventoryRuby'
21
+
22
+ instance = DearInventoryRuby::SaleInvoiceAdditionalCharge.new(description: nil,
23
+ quantity: nil,
24
+ price: nil,
25
+ discount: nil,
26
+ tax: nil,
27
+ total: nil,
28
+ tax_rule: nil,
29
+ account: nil,
30
+ comment: nil)
31
+ ```
32
+
33
+
@@ -0,0 +1,39 @@
1
+ # DearInventoryRuby::SaleInvoiceLine
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **product_id** | **String** | Product identifier referenced by this Line. Required If CombineAdditionalCharges param exist for this endpoint and it have values = false |
8
+ **sku** | **String** | Product SKU referenced by this Line. Required If CombineAdditionalCharges param exist for this endpoint and it have values = false |
9
+ **name** | **String** | Product Name referenced by this Line |
10
+ **quantity** | **Float** | Product or service quantity. Minimal value is 1. |
11
+ **price** | **Float** | Price per unit in Customer currency |
12
+ **discount** | **Float** | Discount. Value between 0 and 100. For free items discount is 100. Default value is 0 | [optional]
13
+ **tax** | **Float** | Tax | [optional]
14
+ **total** | **Float** | Line Total. For validation | [optional]
15
+ **average_cost** | **Float** | Average product cost | [optional]
16
+ **tax_rule** | **String** | Line Tax Rule name. | [optional]
17
+ **account** | **String** | Revenue account | [optional]
18
+ **comment** | **String** | Comment for this line | [optional]
19
+
20
+ ## Code Sample
21
+
22
+ ```ruby
23
+ require 'DearInventoryRuby'
24
+
25
+ instance = DearInventoryRuby::SaleInvoiceLine.new(product_id: nil,
26
+ sku: nil,
27
+ name: nil,
28
+ quantity: nil,
29
+ price: nil,
30
+ discount: nil,
31
+ tax: nil,
32
+ total: nil,
33
+ average_cost: nil,
34
+ tax_rule: nil,
35
+ account: nil,
36
+ comment: nil)
37
+ ```
38
+
39
+
@@ -0,0 +1,19 @@
1
+ # DearInventoryRuby::SaleInvoices
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **sale_id** | **String** | Unique DEAR Sale ID |
8
+ **invoices** | [**Array<SaleInvoice>**](SaleInvoice.md) | Array of Invoices | [optional]
9
+
10
+ ## Code Sample
11
+
12
+ ```ruby
13
+ require 'DearInventoryRuby'
14
+
15
+ instance = DearInventoryRuby::SaleInvoices.new(sale_id: nil,
16
+ invoices: nil)
17
+ ```
18
+
19
+
@@ -31,6 +31,10 @@ require 'dear-inventory-ruby/models/payment_term'
31
31
  require 'dear-inventory-ruby/models/payment_terms'
32
32
  require 'dear-inventory-ruby/models/price_tier'
33
33
  require 'dear-inventory-ruby/models/price_tiers'
34
+ require 'dear-inventory-ruby/models/sale_invoice'
35
+ require 'dear-inventory-ruby/models/sale_invoice_additional_charge'
36
+ require 'dear-inventory-ruby/models/sale_invoice_line'
37
+ require 'dear-inventory-ruby/models/sale_invoices'
34
38
  require 'dear-inventory-ruby/models/success'
35
39
  require 'dear-inventory-ruby/models/tax'
36
40
  require 'dear-inventory-ruby/models/tax_component'
@@ -720,6 +720,69 @@ module DearInventoryRuby
720
720
  return data, status_code, headers
721
721
  end
722
722
 
723
+ # Allows you to retrieve the sale invoices
724
+ # @param [Hash] opts the optional parameters
725
+ # @option opts [String] :sale_id Unique DEAR Sale ID
726
+ # @option opts [Boolean] :combine_additional_charges Show additional charges in 'Lines' array (default to false)
727
+ # @option opts [Boolean] :include_product_info Show all used products in additional array (default to false)
728
+ # @return [SaleInvoices]
729
+ def get_sale_invoices(opts = {})
730
+ data, _status_code, _headers = get_sale_invoices_with_http_info(opts)
731
+ data
732
+ end
733
+
734
+ # Allows you to retrieve the sale invoices
735
+ # @param [Hash] opts the optional parameters
736
+ # @option opts [String] :sale_id Unique DEAR Sale ID
737
+ # @option opts [Boolean] :combine_additional_charges Show additional charges in 'Lines' array
738
+ # @option opts [Boolean] :include_product_info Show all used products in additional array
739
+ # @return [Array<(SaleInvoices, Integer, Hash)>] SaleInvoices data, response status code and response headers
740
+ def get_sale_invoices_with_http_info(opts = {})
741
+ if @api_client.config.debugging
742
+ @api_client.config.logger.debug 'Calling API: InventoryApi.get_sale_invoices ...'
743
+ end
744
+ # resource path
745
+ local_var_path = '/sale/invoice'
746
+
747
+ # query parameters
748
+ query_params = opts[:query_params] || {}
749
+ query_params[:'SaleID'] = opts[:'sale_id'] if !opts[:'sale_id'].nil?
750
+ query_params[:'CombineAdditionalCharges'] = opts[:'combine_additional_charges'] if !opts[:'combine_additional_charges'].nil?
751
+ query_params[:'IncludeProductInfo'] = opts[:'include_product_info'] if !opts[:'include_product_info'].nil?
752
+
753
+ # header parameters
754
+ header_params = opts[:header_params] || {}
755
+ # HTTP header 'Accept' (if needed)
756
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
757
+
758
+ # form parameters
759
+ form_params = opts[:form_params] || {}
760
+
761
+ # http body (model)
762
+ post_body = opts[:body]
763
+
764
+ # return_type
765
+ return_type = opts[:return_type] || 'SaleInvoices'
766
+
767
+ # auth_names
768
+ auth_names = opts[:auth_names] || ['accountID', 'appKey']
769
+
770
+ new_options = opts.merge(
771
+ :header_params => header_params,
772
+ :query_params => query_params,
773
+ :form_params => form_params,
774
+ :body => post_body,
775
+ :auth_names => auth_names,
776
+ :return_type => return_type
777
+ )
778
+
779
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
780
+ if @api_client.config.debugging
781
+ @api_client.config.logger.debug "API called: InventoryApi#get_sale_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
782
+ end
783
+ return data, status_code, headers
784
+ end
785
+
723
786
  # Allows you to retrieve the taxes
724
787
  # @param [Hash] opts the optional parameters
725
788
  # @option opts [String] :page Default is 1 (default to '1')
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DearInventoryRuby
16
+ class SaleInvoice
17
+ # Identifier of sale Invoice task
18
+ attr_accessor :task_id
19
+
20
+ # if true then additional charges lines displayed in Lines array
21
+ attr_accessor :combine_additional_charges
22
+
23
+ # Invoice Number (auto-generated)
24
+ attr_accessor :invoice_number
25
+
26
+ # Additional information for Invoice.
27
+ attr_accessor :memo
28
+
29
+ # Invoice status. Possible Values are values. For POST available values are DRAFT, AUTHORISED
30
+ attr_accessor :status
31
+
32
+ # Invoice Date.
33
+ attr_accessor :invoice_date
34
+
35
+ # Invoice Due Date.
36
+ attr_accessor :invoice_due_date
37
+
38
+ # Decimal with up to 4 decimal places
39
+ attr_accessor :currency_conversion_rate
40
+
41
+ # Billing Address Line 1
42
+ attr_accessor :billing_address_line1
43
+
44
+ # Billing Address Line 2
45
+ attr_accessor :billing_address_line2
46
+
47
+ # Number of Fulfilment linked to this invoice
48
+ attr_accessor :linked_fulfillment_number
49
+
50
+ attr_accessor :lines
51
+
52
+ attr_accessor :additional_charges
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'task_id' => :'TaskID',
58
+ :'combine_additional_charges' => :'CombineAdditionalCharges',
59
+ :'invoice_number' => :'InvoiceNumber',
60
+ :'memo' => :'Memo',
61
+ :'status' => :'Status',
62
+ :'invoice_date' => :'InvoiceDate',
63
+ :'invoice_due_date' => :'InvoiceDueDate',
64
+ :'currency_conversion_rate' => :'CurrencyConversionRate',
65
+ :'billing_address_line1' => :'BillingAddressLine1',
66
+ :'billing_address_line2' => :'BillingAddressLine2',
67
+ :'linked_fulfillment_number' => :'LinkedFulfillmentNumber',
68
+ :'lines' => :'Lines',
69
+ :'additional_charges' => :'AdditionalCharges'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'task_id' => :'String',
77
+ :'combine_additional_charges' => :'Boolean',
78
+ :'invoice_number' => :'String',
79
+ :'memo' => :'String',
80
+ :'status' => :'String',
81
+ :'invoice_date' => :'String',
82
+ :'invoice_due_date' => :'String',
83
+ :'currency_conversion_rate' => :'Float',
84
+ :'billing_address_line1' => :'String',
85
+ :'billing_address_line2' => :'String',
86
+ :'linked_fulfillment_number' => :'Integer',
87
+ :'lines' => :'Array<SaleInvoiceLine>',
88
+ :'additional_charges' => :'Array<SaleInvoiceAdditionalCharge>'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ if (!attributes.is_a?(Hash))
102
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::SaleInvoice` initialize method"
103
+ end
104
+
105
+ # check to see if the attribute exists and convert string to symbol for hash key
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!self.class.attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::SaleInvoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'task_id')
114
+ self.task_id = attributes[:'task_id']
115
+ end
116
+
117
+ if attributes.key?(:'combine_additional_charges')
118
+ self.combine_additional_charges = attributes[:'combine_additional_charges']
119
+ else
120
+ self.combine_additional_charges = false
121
+ end
122
+
123
+ if attributes.key?(:'invoice_number')
124
+ self.invoice_number = attributes[:'invoice_number']
125
+ end
126
+
127
+ if attributes.key?(:'memo')
128
+ self.memo = attributes[:'memo']
129
+ end
130
+
131
+ if attributes.key?(:'status')
132
+ self.status = attributes[:'status']
133
+ end
134
+
135
+ if attributes.key?(:'invoice_date')
136
+ self.invoice_date = attributes[:'invoice_date']
137
+ end
138
+
139
+ if attributes.key?(:'invoice_due_date')
140
+ self.invoice_due_date = attributes[:'invoice_due_date']
141
+ end
142
+
143
+ if attributes.key?(:'currency_conversion_rate')
144
+ self.currency_conversion_rate = attributes[:'currency_conversion_rate']
145
+ end
146
+
147
+ if attributes.key?(:'billing_address_line1')
148
+ self.billing_address_line1 = attributes[:'billing_address_line1']
149
+ end
150
+
151
+ if attributes.key?(:'billing_address_line2')
152
+ self.billing_address_line2 = attributes[:'billing_address_line2']
153
+ end
154
+
155
+ if attributes.key?(:'linked_fulfillment_number')
156
+ self.linked_fulfillment_number = attributes[:'linked_fulfillment_number']
157
+ end
158
+
159
+ if attributes.key?(:'lines')
160
+ if (value = attributes[:'lines']).is_a?(Array)
161
+ self.lines = value
162
+ end
163
+ end
164
+
165
+ if attributes.key?(:'additional_charges')
166
+ if (value = attributes[:'additional_charges']).is_a?(Array)
167
+ self.additional_charges = value
168
+ end
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ invalid_properties = Array.new
176
+ if @task_id.nil?
177
+ invalid_properties.push('invalid value for "task_id", task_id cannot be nil.')
178
+ end
179
+
180
+ if @combine_additional_charges.nil?
181
+ invalid_properties.push('invalid value for "combine_additional_charges", combine_additional_charges cannot be nil.')
182
+ end
183
+
184
+ if @status.nil?
185
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
186
+ end
187
+
188
+ if @invoice_date.nil?
189
+ invalid_properties.push('invalid value for "invoice_date", invoice_date cannot be nil.')
190
+ end
191
+
192
+ if @invoice_due_date.nil?
193
+ invalid_properties.push('invalid value for "invoice_due_date", invoice_due_date cannot be nil.')
194
+ end
195
+
196
+ invalid_properties
197
+ end
198
+
199
+ # Check to see if the all the properties in the model are valid
200
+ # @return true if the model is valid
201
+ def valid?
202
+ return false if @task_id.nil?
203
+ return false if @combine_additional_charges.nil?
204
+ return false if @status.nil?
205
+ return false if @invoice_date.nil?
206
+ return false if @invoice_due_date.nil?
207
+ true
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ task_id == o.task_id &&
216
+ combine_additional_charges == o.combine_additional_charges &&
217
+ invoice_number == o.invoice_number &&
218
+ memo == o.memo &&
219
+ status == o.status &&
220
+ invoice_date == o.invoice_date &&
221
+ invoice_due_date == o.invoice_due_date &&
222
+ currency_conversion_rate == o.currency_conversion_rate &&
223
+ billing_address_line1 == o.billing_address_line1 &&
224
+ billing_address_line2 == o.billing_address_line2 &&
225
+ linked_fulfillment_number == o.linked_fulfillment_number &&
226
+ lines == o.lines &&
227
+ additional_charges == o.additional_charges
228
+ end
229
+
230
+ # @see the `==` method
231
+ # @param [Object] Object to be compared
232
+ def eql?(o)
233
+ self == o
234
+ end
235
+
236
+ # Calculates hash code according to all attributes.
237
+ # @return [Integer] Hash code
238
+ def hash
239
+ [task_id, combine_additional_charges, invoice_number, memo, status, invoice_date, invoice_due_date, currency_conversion_rate, billing_address_line1, billing_address_line2, linked_fulfillment_number, lines, additional_charges].hash
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def self.build_from_hash(attributes)
246
+ new.build_from_hash(attributes)
247
+ end
248
+
249
+ # Builds the object from hash
250
+ # @param [Hash] attributes Model attributes in the form of hash
251
+ # @return [Object] Returns the model itself
252
+ def build_from_hash(attributes)
253
+ return nil unless attributes.is_a?(Hash)
254
+ self.class.openapi_types.each_pair do |key, type|
255
+ if type =~ /\AArray<(.*)>/i
256
+ # check to ensure the input is an array given that the attribute
257
+ # is documented as an array but the input is not
258
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
259
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
260
+ end
261
+ elsif !attributes[self.class.attribute_map[key]].nil?
262
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
263
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
264
+ end
265
+
266
+ self
267
+ end
268
+
269
+ # Deserializes the data based on type
270
+ # @param string type Data type
271
+ # @param string value Value to be deserialized
272
+ # @return [Object] Deserialized data
273
+ def _deserialize(type, value)
274
+ case type.to_sym
275
+ when :DateTime
276
+ DateTime.parse(value)
277
+ when :Date
278
+ Date.parse(value)
279
+ when :String
280
+ value.to_s
281
+ when :Integer
282
+ value.to_i
283
+ when :Float
284
+ value.to_f
285
+ when :Boolean
286
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
287
+ true
288
+ else
289
+ false
290
+ end
291
+ when :Object
292
+ # generic object (usually a Hash), return directly
293
+ value
294
+ when /\AArray<(?<inner_type>.+)>\z/
295
+ inner_type = Regexp.last_match[:inner_type]
296
+ value.map { |v| _deserialize(inner_type, v) }
297
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
298
+ k_type = Regexp.last_match[:k_type]
299
+ v_type = Regexp.last_match[:v_type]
300
+ {}.tap do |hash|
301
+ value.each do |k, v|
302
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
303
+ end
304
+ end
305
+ else # model
306
+ DearInventoryRuby.const_get(type).build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+ end
356
+ end