dear-inventory-ruby 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -4
- data/docs/InventoryApi.md +66 -0
- data/docs/Sale.md +99 -0
- data/lib/dear-inventory-ruby/api/inventory_api.rb +66 -0
- data/lib/dear-inventory-ruby/models/sale.rb +615 -0
- data/lib/dear-inventory-ruby/version.rb +1 -1
- data/lib/dear-inventory-ruby.rb +1 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/inventory_api_spec.rb +14 -0
- data/spec/models/sale_spec.rb +287 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc16b0247ee5118afeefc165b65960ac156aa18e08646de3c076b06f3225d091
|
4
|
+
data.tar.gz: fd18222be798f9d38536629e2ffa62dd70d98a8de5e34e6f3ceaf1aff9b91345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315173b6af1c0d160e46d9462e6d9ddf10a7a23a6fa5200ec4761d28b02602ac24fcffc1080a9a3b0c8ef1cd1b348f05ac1ad1197dcef97a5c67d60ebfd6a6ba
|
7
|
+
data.tar.gz: 0fada5827551de17542f6f3a36f492183447a3abc6fce2d501554aa8070ef96f8f9223156b98a5d8fbe50ae51252cb10576a89f92cb0185f00564d47e9e14e12
|
data/CHANGELOG.md
CHANGED
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.2.
|
10
|
+
- Package version: 0.2.4
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
12
12
|
For more information, please visit [https://www.nhansg.com](https://www.nhansg.com)
|
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.2.
|
27
|
+
gem install ./dear-inventory-ruby-0.2.4.gem
|
28
28
|
```
|
29
29
|
|
30
|
-
(for development, run `gem install --dev ./dear-inventory-ruby-0.2.
|
30
|
+
(for development, run `gem install --dev ./dear-inventory-ruby-0.2.4.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.2.
|
36
|
+
gem 'dear-inventory-ruby', '~> 0.2.4'
|
37
37
|
|
38
38
|
### Install from Git
|
39
39
|
|
@@ -111,6 +111,7 @@ Class | Method | HTTP request | Description
|
|
111
111
|
*DearInventoryRuby::InventoryApi* | [**get_me**](docs/InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
|
112
112
|
*DearInventoryRuby::InventoryApi* | [**get_payment_terms**](docs/InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
|
113
113
|
*DearInventoryRuby::InventoryApi* | [**get_price_tiers**](docs/InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
|
114
|
+
*DearInventoryRuby::InventoryApi* | [**get_sale**](docs/InventoryApi.md#get_sale) | **GET** /sale | Allows you to retrieve the Sale
|
114
115
|
*DearInventoryRuby::InventoryApi* | [**get_sale_invoices**](docs/InventoryApi.md#get_sale_invoices) | **GET** /sale/invoice | Allows you to retrieve the sale invoices
|
115
116
|
*DearInventoryRuby::InventoryApi* | [**get_sale_order**](docs/InventoryApi.md#get_sale_order) | **GET** /sale/order | Allows you to retrieve the Sale Order
|
116
117
|
*DearInventoryRuby::InventoryApi* | [**get_sale_payment**](docs/InventoryApi.md#get_sale_payment) | **GET** /sale/payment | Allows you to retrieve the Sale Payments
|
@@ -141,6 +142,7 @@ Class | Method | HTTP request | Description
|
|
141
142
|
- [DearInventoryRuby::PaymentTerms](docs/PaymentTerms.md)
|
142
143
|
- [DearInventoryRuby::PriceTier](docs/PriceTier.md)
|
143
144
|
- [DearInventoryRuby::PriceTiers](docs/PriceTiers.md)
|
145
|
+
- [DearInventoryRuby::Sale](docs/Sale.md)
|
144
146
|
- [DearInventoryRuby::SaleAdditionalCharge](docs/SaleAdditionalCharge.md)
|
145
147
|
- [DearInventoryRuby::SaleInvoice](docs/SaleInvoice.md)
|
146
148
|
- [DearInventoryRuby::SaleInvoiceAdditionalCharge](docs/SaleInvoiceAdditionalCharge.md)
|
data/docs/InventoryApi.md
CHANGED
@@ -23,6 +23,7 @@ Method | HTTP request | Description
|
|
23
23
|
[**get_me**](InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
|
24
24
|
[**get_payment_terms**](InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
|
25
25
|
[**get_price_tiers**](InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
|
26
|
+
[**get_sale**](InventoryApi.md#get_sale) | **GET** /sale | Allows you to retrieve the Sale
|
26
27
|
[**get_sale_invoices**](InventoryApi.md#get_sale_invoices) | **GET** /sale/invoice | Allows you to retrieve the sale invoices
|
27
28
|
[**get_sale_order**](InventoryApi.md#get_sale_order) | **GET** /sale/order | Allows you to retrieve the Sale Order
|
28
29
|
[**get_sale_payment**](InventoryApi.md#get_sale_payment) | **GET** /sale/payment | Allows you to retrieve the Sale Payments
|
@@ -1201,6 +1202,71 @@ This endpoint does not need any parameter.
|
|
1201
1202
|
- **Accept**: application/json
|
1202
1203
|
|
1203
1204
|
|
1205
|
+
## get_sale
|
1206
|
+
|
1207
|
+
> Sale get_sale(opts)
|
1208
|
+
|
1209
|
+
Allows you to retrieve the Sale
|
1210
|
+
|
1211
|
+
### Example
|
1212
|
+
|
1213
|
+
```ruby
|
1214
|
+
# load the gem
|
1215
|
+
require 'dear-inventory-ruby'
|
1216
|
+
# setup authorization
|
1217
|
+
DearInventoryRuby.configure do |config|
|
1218
|
+
# Configure API key authorization: accountID
|
1219
|
+
config.api_key['api-auth-accountid'] = 'YOUR API KEY'
|
1220
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
1221
|
+
#config.api_key_prefix['api-auth-accountid'] = 'Bearer'
|
1222
|
+
|
1223
|
+
# Configure API key authorization: appKey
|
1224
|
+
config.api_key['api-auth-applicationkey'] = 'YOUR API KEY'
|
1225
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
1226
|
+
#config.api_key_prefix['api-auth-applicationkey'] = 'Bearer'
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
api_instance = DearInventoryRuby::InventoryApi.new
|
1230
|
+
opts = {
|
1231
|
+
id: 'id_example', # String | Default is nil
|
1232
|
+
combine_additional_charges: false, # Boolean | Show additional charges in 'Lines' array
|
1233
|
+
hide_inventory_movements: false, # Boolean | Hide inventory movements (Default = false)
|
1234
|
+
include_transactions: false # Boolean | Show related transactions (Default = false)
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
begin
|
1238
|
+
#Allows you to retrieve the Sale
|
1239
|
+
result = api_instance.get_sale(opts)
|
1240
|
+
p result
|
1241
|
+
rescue DearInventoryRuby::ApiError => e
|
1242
|
+
puts "Exception when calling InventoryApi->get_sale: #{e}"
|
1243
|
+
end
|
1244
|
+
```
|
1245
|
+
|
1246
|
+
### Parameters
|
1247
|
+
|
1248
|
+
|
1249
|
+
Name | Type | Description | Notes
|
1250
|
+
------------- | ------------- | ------------- | -------------
|
1251
|
+
**id** | **String**| Default is nil | [optional]
|
1252
|
+
**combine_additional_charges** | **Boolean**| Show additional charges in 'Lines' array | [optional] [default to false]
|
1253
|
+
**hide_inventory_movements** | **Boolean**| Hide inventory movements (Default = false) | [optional] [default to false]
|
1254
|
+
**include_transactions** | **Boolean**| Show related transactions (Default = false) | [optional] [default to false]
|
1255
|
+
|
1256
|
+
### Return type
|
1257
|
+
|
1258
|
+
[**Sale**](Sale.md)
|
1259
|
+
|
1260
|
+
### Authorization
|
1261
|
+
|
1262
|
+
[accountID](../README.md#accountID), [appKey](../README.md#appKey)
|
1263
|
+
|
1264
|
+
### HTTP request headers
|
1265
|
+
|
1266
|
+
- **Content-Type**: Not defined
|
1267
|
+
- **Accept**: application/json
|
1268
|
+
|
1269
|
+
|
1204
1270
|
## get_sale_invoices
|
1205
1271
|
|
1206
1272
|
> SaleInvoices get_sale_invoices(opts)
|
data/docs/Sale.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# DearInventoryRuby::Sale
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**id** | **String** | Unique DEAR Sale ID. Required for PUT | [optional]
|
8
|
+
**customer** | **String** | Customer name | [optional]
|
9
|
+
**customer_id** | **String** | Customer identifier | [optional]
|
10
|
+
**contact** | **String** | Customer Contact name | [optional]
|
11
|
+
**phone** | **String** | Customer Contact phone | [optional]
|
12
|
+
**email** | **String** | Customer Contact email | [optional]
|
13
|
+
**default_account** | **String** | Account code used by default for invoice lines when no revenue account is defined on Product. By default it is equal to Customer Sale account | [optional]
|
14
|
+
**skip_quote** | **Boolean** | True if there is no quote in the sale | [optional]
|
15
|
+
**billing_address** | [**Address**](Address.md) | | [optional]
|
16
|
+
**shipping_address** | [**ShippingAddress**](ShippingAddress.md) | | [optional]
|
17
|
+
**shipping_notes** | **String** | Shipping Notes | [optional]
|
18
|
+
**base_currency** | **String** | 3 character currency code of Base Currency defined in General Settings on the moment when Sale was created. | [optional]
|
19
|
+
**customer_currency** | **String** | 3 character currency code of customer Currency defined in Customer card at the moment when customer is selected for the Sale. | [optional]
|
20
|
+
**tax_rule** | **String** | Default Tax Rule name selected for Sale | [optional]
|
21
|
+
**tax_calculation** | **String** | Inclusive or Exclusive | [optional]
|
22
|
+
**terms** | **String** | Payment terms name | [optional]
|
23
|
+
**price_tier** | **String** | Price Tier name selected for Sale | [optional]
|
24
|
+
**ship_by** | **Date** | Date when shipment is due | [optional]
|
25
|
+
**location** | **String** | Default location to pick stock from | [optional]
|
26
|
+
**sale_order_date** | **Date** | Date when task was created | [optional]
|
27
|
+
**last_modified_on** | **Date** | UTC Time | [optional]
|
28
|
+
**note** | **String** | Custom Sale note | [optional]
|
29
|
+
**customer_reference** | **String** | Reference number used by customer to identify this sale. Could be a purchase order number generated by customer. | [optional]
|
30
|
+
**cogs_amount** | **Float** | COGS amount in base currency | [optional]
|
31
|
+
**status** | **String** | Sale Status, see possible values | [optional]
|
32
|
+
**combined_picking_status** | **String** | Pick status. Possible Values are VOIDED, NOT AVAILABLE, PICKED, PICKING , NOT PICKED , PARTIALLY PICKED | [optional]
|
33
|
+
**combined_packing_status** | **String** | Pack status. Possible Values are VOIDED, NOT AVAILABLE, PACKED, PACKING, NOT PACKED, PARTIALLY PACKED | [optional]
|
34
|
+
**combined_shipping_status** | **String** | Ship status. Possible Values are VOIDED, NOT AVAILABLE, SHIPPED, SHIPPING , NOT SHIPPED , PARTIALLY SHIPPED | [optional]
|
35
|
+
**ful_filment_status** | **String** | Fulfilment status. Possible Values are FULFILLED, PARTIALLY FULFILLED, NOT AVAILABLE, NOT FULFILLED, VOIDED | [optional]
|
36
|
+
**combined_invoice_status** | **String** | Invoice status. Possible Values are INVOICED, INVOICED / CREDITED, NOT AVAILABLE, NOT INVOICED, PARTIALLY INVOICED, PARTIALLY INVOICED / CREDITED | [optional]
|
37
|
+
**combined_payment_status** | **String** | Payment status. Possible Values are NOT REFUNDED, PREPAID, PARTIALLY PAID, UNPAID, PAID, VOIDED | [optional]
|
38
|
+
**combined_tracking_numbers** | **String** | Tracking Numbers | [optional]
|
39
|
+
**carrier** | **String** | Name of Carrier/shipping method | [optional]
|
40
|
+
**currency_rate** | **Float** | Conversion Rate expressed as number of Base currency units for one Customer currency unit | [optional]
|
41
|
+
**sales_representative** | **String** | Sales representative name | [optional]
|
42
|
+
**type** | **String** | Type of sale Simple Sale or Advanced Sale, Service Sale | [optional]
|
43
|
+
**source_channel** | **String** | Source of the sale. read-only field | [optional]
|
44
|
+
**external_id** | **String** | Custom field that is only available in API and allows to set arbitrary value for the sale for later search and any custom logic | [optional]
|
45
|
+
**service_only** | **String** | true when it is service-only sale | [optional]
|
46
|
+
**quote** | [**SaleQuote**](SaleQuote.md) | | [optional]
|
47
|
+
**order** | [**SaleOrder**](SaleOrder.md) | | [optional]
|
48
|
+
**invoices** | [**Array<SaleInvoice>**](SaleInvoice.md) | Sale Invoices | [optional]
|
49
|
+
|
50
|
+
## Code Sample
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
require 'DearInventoryRuby'
|
54
|
+
|
55
|
+
instance = DearInventoryRuby::Sale.new(id: nil,
|
56
|
+
customer: nil,
|
57
|
+
customer_id: nil,
|
58
|
+
contact: nil,
|
59
|
+
phone: nil,
|
60
|
+
email: nil,
|
61
|
+
default_account: nil,
|
62
|
+
skip_quote: nil,
|
63
|
+
billing_address: nil,
|
64
|
+
shipping_address: nil,
|
65
|
+
shipping_notes: nil,
|
66
|
+
base_currency: nil,
|
67
|
+
customer_currency: nil,
|
68
|
+
tax_rule: nil,
|
69
|
+
tax_calculation: nil,
|
70
|
+
terms: nil,
|
71
|
+
price_tier: nil,
|
72
|
+
ship_by: nil,
|
73
|
+
location: nil,
|
74
|
+
sale_order_date: nil,
|
75
|
+
last_modified_on: nil,
|
76
|
+
note: nil,
|
77
|
+
customer_reference: nil,
|
78
|
+
cogs_amount: nil,
|
79
|
+
status: nil,
|
80
|
+
combined_picking_status: nil,
|
81
|
+
combined_packing_status: nil,
|
82
|
+
combined_shipping_status: nil,
|
83
|
+
ful_filment_status: nil,
|
84
|
+
combined_invoice_status: nil,
|
85
|
+
combined_payment_status: nil,
|
86
|
+
combined_tracking_numbers: nil,
|
87
|
+
carrier: nil,
|
88
|
+
currency_rate: nil,
|
89
|
+
sales_representative: nil,
|
90
|
+
type: nil,
|
91
|
+
source_channel: nil,
|
92
|
+
external_id: nil,
|
93
|
+
service_only: nil,
|
94
|
+
quote: nil,
|
95
|
+
order: nil,
|
96
|
+
invoices: nil)
|
97
|
+
```
|
98
|
+
|
99
|
+
|
@@ -1222,6 +1222,72 @@ module DearInventoryRuby
|
|
1222
1222
|
return data, status_code, headers
|
1223
1223
|
end
|
1224
1224
|
|
1225
|
+
# Allows you to retrieve the Sale
|
1226
|
+
# @param [Hash] opts the optional parameters
|
1227
|
+
# @option opts [String] :id Default is nil
|
1228
|
+
# @option opts [Boolean] :combine_additional_charges Show additional charges in 'Lines' array (default to false)
|
1229
|
+
# @option opts [Boolean] :hide_inventory_movements Hide inventory movements (Default = false) (default to false)
|
1230
|
+
# @option opts [Boolean] :include_transactions Show related transactions (Default = false) (default to false)
|
1231
|
+
# @return [Sale]
|
1232
|
+
def get_sale(opts = {})
|
1233
|
+
data, _status_code, _headers = get_sale_with_http_info(opts)
|
1234
|
+
data
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
# Allows you to retrieve the Sale
|
1238
|
+
# @param [Hash] opts the optional parameters
|
1239
|
+
# @option opts [String] :id Default is nil
|
1240
|
+
# @option opts [Boolean] :combine_additional_charges Show additional charges in 'Lines' array
|
1241
|
+
# @option opts [Boolean] :hide_inventory_movements Hide inventory movements (Default = false)
|
1242
|
+
# @option opts [Boolean] :include_transactions Show related transactions (Default = false)
|
1243
|
+
# @return [Array<(Sale, Integer, Hash)>] Sale data, response status code and response headers
|
1244
|
+
def get_sale_with_http_info(opts = {})
|
1245
|
+
if @api_client.config.debugging
|
1246
|
+
@api_client.config.logger.debug 'Calling API: InventoryApi.get_sale ...'
|
1247
|
+
end
|
1248
|
+
# resource path
|
1249
|
+
local_var_path = '/sale'
|
1250
|
+
|
1251
|
+
# query parameters
|
1252
|
+
query_params = opts[:query_params] || {}
|
1253
|
+
query_params[:'ID'] = opts[:'id'] if !opts[:'id'].nil?
|
1254
|
+
query_params[:'CombineAdditionalCharges'] = opts[:'combine_additional_charges'] if !opts[:'combine_additional_charges'].nil?
|
1255
|
+
query_params[:'HideInventoryMovements'] = opts[:'hide_inventory_movements'] if !opts[:'hide_inventory_movements'].nil?
|
1256
|
+
query_params[:'IncludeTransactions'] = opts[:'include_transactions'] if !opts[:'include_transactions'].nil?
|
1257
|
+
|
1258
|
+
# header parameters
|
1259
|
+
header_params = opts[:header_params] || {}
|
1260
|
+
# HTTP header 'Accept' (if needed)
|
1261
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1262
|
+
|
1263
|
+
# form parameters
|
1264
|
+
form_params = opts[:form_params] || {}
|
1265
|
+
|
1266
|
+
# http body (model)
|
1267
|
+
post_body = opts[:body]
|
1268
|
+
|
1269
|
+
# return_type
|
1270
|
+
return_type = opts[:return_type] || 'Sale'
|
1271
|
+
|
1272
|
+
# auth_names
|
1273
|
+
auth_names = opts[:auth_names] || ['accountID', 'appKey']
|
1274
|
+
|
1275
|
+
new_options = opts.merge(
|
1276
|
+
:header_params => header_params,
|
1277
|
+
:query_params => query_params,
|
1278
|
+
:form_params => form_params,
|
1279
|
+
:body => post_body,
|
1280
|
+
:auth_names => auth_names,
|
1281
|
+
:return_type => return_type
|
1282
|
+
)
|
1283
|
+
|
1284
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
1285
|
+
if @api_client.config.debugging
|
1286
|
+
@api_client.config.logger.debug "API called: InventoryApi#get_sale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1287
|
+
end
|
1288
|
+
return data, status_code, headers
|
1289
|
+
end
|
1290
|
+
|
1225
1291
|
# Allows you to retrieve the sale invoices
|
1226
1292
|
# @param [Hash] opts the optional parameters
|
1227
1293
|
# @option opts [String] :sale_id Unique DEAR Sale ID
|
@@ -0,0 +1,615 @@
|
|
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 Sale
|
17
|
+
# Unique DEAR Sale ID. Required for PUT
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# Customer name
|
21
|
+
attr_accessor :customer
|
22
|
+
|
23
|
+
# Customer identifier
|
24
|
+
attr_accessor :customer_id
|
25
|
+
|
26
|
+
# Customer Contact name
|
27
|
+
attr_accessor :contact
|
28
|
+
|
29
|
+
# Customer Contact phone
|
30
|
+
attr_accessor :phone
|
31
|
+
|
32
|
+
# Customer Contact email
|
33
|
+
attr_accessor :email
|
34
|
+
|
35
|
+
# Account code used by default for invoice lines when no revenue account is defined on Product. By default it is equal to Customer Sale account
|
36
|
+
attr_accessor :default_account
|
37
|
+
|
38
|
+
# True if there is no quote in the sale
|
39
|
+
attr_accessor :skip_quote
|
40
|
+
|
41
|
+
attr_accessor :billing_address
|
42
|
+
|
43
|
+
attr_accessor :shipping_address
|
44
|
+
|
45
|
+
# Shipping Notes
|
46
|
+
attr_accessor :shipping_notes
|
47
|
+
|
48
|
+
# 3 character currency code of Base Currency defined in General Settings on the moment when Sale was created.
|
49
|
+
attr_accessor :base_currency
|
50
|
+
|
51
|
+
# 3 character currency code of customer Currency defined in Customer card at the moment when customer is selected for the Sale.
|
52
|
+
attr_accessor :customer_currency
|
53
|
+
|
54
|
+
# Default Tax Rule name selected for Sale
|
55
|
+
attr_accessor :tax_rule
|
56
|
+
|
57
|
+
# Inclusive or Exclusive
|
58
|
+
attr_accessor :tax_calculation
|
59
|
+
|
60
|
+
# Payment terms name
|
61
|
+
attr_accessor :terms
|
62
|
+
|
63
|
+
# Price Tier name selected for Sale
|
64
|
+
attr_accessor :price_tier
|
65
|
+
|
66
|
+
# Date when shipment is due
|
67
|
+
attr_accessor :ship_by
|
68
|
+
|
69
|
+
# Default location to pick stock from
|
70
|
+
attr_accessor :location
|
71
|
+
|
72
|
+
# Date when task was created
|
73
|
+
attr_accessor :sale_order_date
|
74
|
+
|
75
|
+
# UTC Time
|
76
|
+
attr_accessor :last_modified_on
|
77
|
+
|
78
|
+
# Custom Sale note
|
79
|
+
attr_accessor :note
|
80
|
+
|
81
|
+
# Reference number used by customer to identify this sale. Could be a purchase order number generated by customer.
|
82
|
+
attr_accessor :customer_reference
|
83
|
+
|
84
|
+
# COGS amount in base currency
|
85
|
+
attr_accessor :cogs_amount
|
86
|
+
|
87
|
+
# Sale Status, see possible values
|
88
|
+
attr_accessor :status
|
89
|
+
|
90
|
+
# Pick status. Possible Values are VOIDED, NOT AVAILABLE, PICKED, PICKING , NOT PICKED , PARTIALLY PICKED
|
91
|
+
attr_accessor :combined_picking_status
|
92
|
+
|
93
|
+
# Pack status. Possible Values are VOIDED, NOT AVAILABLE, PACKED, PACKING, NOT PACKED, PARTIALLY PACKED
|
94
|
+
attr_accessor :combined_packing_status
|
95
|
+
|
96
|
+
# Ship status. Possible Values are VOIDED, NOT AVAILABLE, SHIPPED, SHIPPING , NOT SHIPPED , PARTIALLY SHIPPED
|
97
|
+
attr_accessor :combined_shipping_status
|
98
|
+
|
99
|
+
# Fulfilment status. Possible Values are FULFILLED, PARTIALLY FULFILLED, NOT AVAILABLE, NOT FULFILLED, VOIDED
|
100
|
+
attr_accessor :ful_filment_status
|
101
|
+
|
102
|
+
# Invoice status. Possible Values are INVOICED, INVOICED / CREDITED, NOT AVAILABLE, NOT INVOICED, PARTIALLY INVOICED, PARTIALLY INVOICED / CREDITED
|
103
|
+
attr_accessor :combined_invoice_status
|
104
|
+
|
105
|
+
# Payment status. Possible Values are NOT REFUNDED, PREPAID, PARTIALLY PAID, UNPAID, PAID, VOIDED
|
106
|
+
attr_accessor :combined_payment_status
|
107
|
+
|
108
|
+
# Tracking Numbers
|
109
|
+
attr_accessor :combined_tracking_numbers
|
110
|
+
|
111
|
+
# Name of Carrier/shipping method
|
112
|
+
attr_accessor :carrier
|
113
|
+
|
114
|
+
# Conversion Rate expressed as number of Base currency units for one Customer currency unit
|
115
|
+
attr_accessor :currency_rate
|
116
|
+
|
117
|
+
# Sales representative name
|
118
|
+
attr_accessor :sales_representative
|
119
|
+
|
120
|
+
# Type of sale Simple Sale or Advanced Sale, Service Sale
|
121
|
+
attr_accessor :type
|
122
|
+
|
123
|
+
# Source of the sale. read-only field
|
124
|
+
attr_accessor :source_channel
|
125
|
+
|
126
|
+
# Custom field that is only available in API and allows to set arbitrary value for the sale for later search and any custom logic
|
127
|
+
attr_accessor :external_id
|
128
|
+
|
129
|
+
# true when it is service-only sale
|
130
|
+
attr_accessor :service_only
|
131
|
+
|
132
|
+
attr_accessor :quote
|
133
|
+
|
134
|
+
attr_accessor :order
|
135
|
+
|
136
|
+
# Sale Invoices
|
137
|
+
attr_accessor :invoices
|
138
|
+
|
139
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
140
|
+
def self.attribute_map
|
141
|
+
{
|
142
|
+
:'id' => :'ID',
|
143
|
+
:'customer' => :'Customer',
|
144
|
+
:'customer_id' => :'CustomerID',
|
145
|
+
:'contact' => :'Contact',
|
146
|
+
:'phone' => :'Phone',
|
147
|
+
:'email' => :'Email',
|
148
|
+
:'default_account' => :'DefaultAccount',
|
149
|
+
:'skip_quote' => :'SkipQuote',
|
150
|
+
:'billing_address' => :'BillingAddress',
|
151
|
+
:'shipping_address' => :'ShippingAddress',
|
152
|
+
:'shipping_notes' => :'ShippingNotes',
|
153
|
+
:'base_currency' => :'BaseCurrency',
|
154
|
+
:'customer_currency' => :'CustomerCurrency',
|
155
|
+
:'tax_rule' => :'TaxRule',
|
156
|
+
:'tax_calculation' => :'TaxCalculation',
|
157
|
+
:'terms' => :'Terms',
|
158
|
+
:'price_tier' => :'PriceTier',
|
159
|
+
:'ship_by' => :'ShipBy',
|
160
|
+
:'location' => :'Location',
|
161
|
+
:'sale_order_date' => :'SaleOrderDate',
|
162
|
+
:'last_modified_on' => :'LastModifiedOn',
|
163
|
+
:'note' => :'Note',
|
164
|
+
:'customer_reference' => :'CustomerReference',
|
165
|
+
:'cogs_amount' => :'COGSAmount',
|
166
|
+
:'status' => :'Status',
|
167
|
+
:'combined_picking_status' => :'CombinedPickingStatus',
|
168
|
+
:'combined_packing_status' => :'CombinedPackingStatus',
|
169
|
+
:'combined_shipping_status' => :'CombinedShippingStatus',
|
170
|
+
:'ful_filment_status' => :'FulFilmentStatus',
|
171
|
+
:'combined_invoice_status' => :'CombinedInvoiceStatus',
|
172
|
+
:'combined_payment_status' => :'CombinedPaymentStatus',
|
173
|
+
:'combined_tracking_numbers' => :'CombinedTrackingNumbers',
|
174
|
+
:'carrier' => :'Carrier',
|
175
|
+
:'currency_rate' => :'CurrencyRate',
|
176
|
+
:'sales_representative' => :'SalesRepresentative',
|
177
|
+
:'type' => :'Type',
|
178
|
+
:'source_channel' => :'SourceChannel',
|
179
|
+
:'external_id' => :'ExternalID',
|
180
|
+
:'service_only' => :'ServiceOnly',
|
181
|
+
:'quote' => :'Quote',
|
182
|
+
:'order' => :'Order',
|
183
|
+
:'invoices' => :'Invoices'
|
184
|
+
}
|
185
|
+
end
|
186
|
+
|
187
|
+
# Attribute type mapping.
|
188
|
+
def self.openapi_types
|
189
|
+
{
|
190
|
+
:'id' => :'String',
|
191
|
+
:'customer' => :'String',
|
192
|
+
:'customer_id' => :'String',
|
193
|
+
:'contact' => :'String',
|
194
|
+
:'phone' => :'String',
|
195
|
+
:'email' => :'String',
|
196
|
+
:'default_account' => :'String',
|
197
|
+
:'skip_quote' => :'Boolean',
|
198
|
+
:'billing_address' => :'Address',
|
199
|
+
:'shipping_address' => :'ShippingAddress',
|
200
|
+
:'shipping_notes' => :'String',
|
201
|
+
:'base_currency' => :'String',
|
202
|
+
:'customer_currency' => :'String',
|
203
|
+
:'tax_rule' => :'String',
|
204
|
+
:'tax_calculation' => :'String',
|
205
|
+
:'terms' => :'String',
|
206
|
+
:'price_tier' => :'String',
|
207
|
+
:'ship_by' => :'Date',
|
208
|
+
:'location' => :'String',
|
209
|
+
:'sale_order_date' => :'Date',
|
210
|
+
:'last_modified_on' => :'Date',
|
211
|
+
:'note' => :'String',
|
212
|
+
:'customer_reference' => :'String',
|
213
|
+
:'cogs_amount' => :'Float',
|
214
|
+
:'status' => :'String',
|
215
|
+
:'combined_picking_status' => :'String',
|
216
|
+
:'combined_packing_status' => :'String',
|
217
|
+
:'combined_shipping_status' => :'String',
|
218
|
+
:'ful_filment_status' => :'String',
|
219
|
+
:'combined_invoice_status' => :'String',
|
220
|
+
:'combined_payment_status' => :'String',
|
221
|
+
:'combined_tracking_numbers' => :'String',
|
222
|
+
:'carrier' => :'String',
|
223
|
+
:'currency_rate' => :'Float',
|
224
|
+
:'sales_representative' => :'String',
|
225
|
+
:'type' => :'String',
|
226
|
+
:'source_channel' => :'String',
|
227
|
+
:'external_id' => :'String',
|
228
|
+
:'service_only' => :'String',
|
229
|
+
:'quote' => :'SaleQuote',
|
230
|
+
:'order' => :'SaleOrder',
|
231
|
+
:'invoices' => :'Array<SaleInvoice>'
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
235
|
+
# List of attributes with nullable: true
|
236
|
+
def self.openapi_nullable
|
237
|
+
Set.new([
|
238
|
+
])
|
239
|
+
end
|
240
|
+
|
241
|
+
# Initializes the object
|
242
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
243
|
+
def initialize(attributes = {})
|
244
|
+
if (!attributes.is_a?(Hash))
|
245
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::Sale` initialize method"
|
246
|
+
end
|
247
|
+
|
248
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
249
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
250
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
251
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::Sale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
252
|
+
end
|
253
|
+
h[k.to_sym] = v
|
254
|
+
}
|
255
|
+
|
256
|
+
if attributes.key?(:'id')
|
257
|
+
self.id = attributes[:'id']
|
258
|
+
end
|
259
|
+
|
260
|
+
if attributes.key?(:'customer')
|
261
|
+
self.customer = attributes[:'customer']
|
262
|
+
end
|
263
|
+
|
264
|
+
if attributes.key?(:'customer_id')
|
265
|
+
self.customer_id = attributes[:'customer_id']
|
266
|
+
end
|
267
|
+
|
268
|
+
if attributes.key?(:'contact')
|
269
|
+
self.contact = attributes[:'contact']
|
270
|
+
end
|
271
|
+
|
272
|
+
if attributes.key?(:'phone')
|
273
|
+
self.phone = attributes[:'phone']
|
274
|
+
end
|
275
|
+
|
276
|
+
if attributes.key?(:'email')
|
277
|
+
self.email = attributes[:'email']
|
278
|
+
end
|
279
|
+
|
280
|
+
if attributes.key?(:'default_account')
|
281
|
+
self.default_account = attributes[:'default_account']
|
282
|
+
end
|
283
|
+
|
284
|
+
if attributes.key?(:'skip_quote')
|
285
|
+
self.skip_quote = attributes[:'skip_quote']
|
286
|
+
end
|
287
|
+
|
288
|
+
if attributes.key?(:'billing_address')
|
289
|
+
self.billing_address = attributes[:'billing_address']
|
290
|
+
end
|
291
|
+
|
292
|
+
if attributes.key?(:'shipping_address')
|
293
|
+
self.shipping_address = attributes[:'shipping_address']
|
294
|
+
end
|
295
|
+
|
296
|
+
if attributes.key?(:'shipping_notes')
|
297
|
+
self.shipping_notes = attributes[:'shipping_notes']
|
298
|
+
end
|
299
|
+
|
300
|
+
if attributes.key?(:'base_currency')
|
301
|
+
self.base_currency = attributes[:'base_currency']
|
302
|
+
end
|
303
|
+
|
304
|
+
if attributes.key?(:'customer_currency')
|
305
|
+
self.customer_currency = attributes[:'customer_currency']
|
306
|
+
end
|
307
|
+
|
308
|
+
if attributes.key?(:'tax_rule')
|
309
|
+
self.tax_rule = attributes[:'tax_rule']
|
310
|
+
end
|
311
|
+
|
312
|
+
if attributes.key?(:'tax_calculation')
|
313
|
+
self.tax_calculation = attributes[:'tax_calculation']
|
314
|
+
end
|
315
|
+
|
316
|
+
if attributes.key?(:'terms')
|
317
|
+
self.terms = attributes[:'terms']
|
318
|
+
end
|
319
|
+
|
320
|
+
if attributes.key?(:'price_tier')
|
321
|
+
self.price_tier = attributes[:'price_tier']
|
322
|
+
end
|
323
|
+
|
324
|
+
if attributes.key?(:'ship_by')
|
325
|
+
self.ship_by = attributes[:'ship_by']
|
326
|
+
end
|
327
|
+
|
328
|
+
if attributes.key?(:'location')
|
329
|
+
self.location = attributes[:'location']
|
330
|
+
end
|
331
|
+
|
332
|
+
if attributes.key?(:'sale_order_date')
|
333
|
+
self.sale_order_date = attributes[:'sale_order_date']
|
334
|
+
end
|
335
|
+
|
336
|
+
if attributes.key?(:'last_modified_on')
|
337
|
+
self.last_modified_on = attributes[:'last_modified_on']
|
338
|
+
end
|
339
|
+
|
340
|
+
if attributes.key?(:'note')
|
341
|
+
self.note = attributes[:'note']
|
342
|
+
end
|
343
|
+
|
344
|
+
if attributes.key?(:'customer_reference')
|
345
|
+
self.customer_reference = attributes[:'customer_reference']
|
346
|
+
end
|
347
|
+
|
348
|
+
if attributes.key?(:'cogs_amount')
|
349
|
+
self.cogs_amount = attributes[:'cogs_amount']
|
350
|
+
end
|
351
|
+
|
352
|
+
if attributes.key?(:'status')
|
353
|
+
self.status = attributes[:'status']
|
354
|
+
end
|
355
|
+
|
356
|
+
if attributes.key?(:'combined_picking_status')
|
357
|
+
self.combined_picking_status = attributes[:'combined_picking_status']
|
358
|
+
end
|
359
|
+
|
360
|
+
if attributes.key?(:'combined_packing_status')
|
361
|
+
self.combined_packing_status = attributes[:'combined_packing_status']
|
362
|
+
end
|
363
|
+
|
364
|
+
if attributes.key?(:'combined_shipping_status')
|
365
|
+
self.combined_shipping_status = attributes[:'combined_shipping_status']
|
366
|
+
end
|
367
|
+
|
368
|
+
if attributes.key?(:'ful_filment_status')
|
369
|
+
self.ful_filment_status = attributes[:'ful_filment_status']
|
370
|
+
end
|
371
|
+
|
372
|
+
if attributes.key?(:'combined_invoice_status')
|
373
|
+
self.combined_invoice_status = attributes[:'combined_invoice_status']
|
374
|
+
end
|
375
|
+
|
376
|
+
if attributes.key?(:'combined_payment_status')
|
377
|
+
self.combined_payment_status = attributes[:'combined_payment_status']
|
378
|
+
end
|
379
|
+
|
380
|
+
if attributes.key?(:'combined_tracking_numbers')
|
381
|
+
self.combined_tracking_numbers = attributes[:'combined_tracking_numbers']
|
382
|
+
end
|
383
|
+
|
384
|
+
if attributes.key?(:'carrier')
|
385
|
+
self.carrier = attributes[:'carrier']
|
386
|
+
end
|
387
|
+
|
388
|
+
if attributes.key?(:'currency_rate')
|
389
|
+
self.currency_rate = attributes[:'currency_rate']
|
390
|
+
end
|
391
|
+
|
392
|
+
if attributes.key?(:'sales_representative')
|
393
|
+
self.sales_representative = attributes[:'sales_representative']
|
394
|
+
end
|
395
|
+
|
396
|
+
if attributes.key?(:'type')
|
397
|
+
self.type = attributes[:'type']
|
398
|
+
end
|
399
|
+
|
400
|
+
if attributes.key?(:'source_channel')
|
401
|
+
self.source_channel = attributes[:'source_channel']
|
402
|
+
end
|
403
|
+
|
404
|
+
if attributes.key?(:'external_id')
|
405
|
+
self.external_id = attributes[:'external_id']
|
406
|
+
end
|
407
|
+
|
408
|
+
if attributes.key?(:'service_only')
|
409
|
+
self.service_only = attributes[:'service_only']
|
410
|
+
end
|
411
|
+
|
412
|
+
if attributes.key?(:'quote')
|
413
|
+
self.quote = attributes[:'quote']
|
414
|
+
end
|
415
|
+
|
416
|
+
if attributes.key?(:'order')
|
417
|
+
self.order = attributes[:'order']
|
418
|
+
end
|
419
|
+
|
420
|
+
if attributes.key?(:'invoices')
|
421
|
+
if (value = attributes[:'invoices']).is_a?(Array)
|
422
|
+
self.invoices = value
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
428
|
+
# @return Array for valid properties with the reasons
|
429
|
+
def list_invalid_properties
|
430
|
+
invalid_properties = Array.new
|
431
|
+
invalid_properties
|
432
|
+
end
|
433
|
+
|
434
|
+
# Check to see if the all the properties in the model are valid
|
435
|
+
# @return true if the model is valid
|
436
|
+
def valid?
|
437
|
+
true
|
438
|
+
end
|
439
|
+
|
440
|
+
# Checks equality by comparing each attribute.
|
441
|
+
# @param [Object] Object to be compared
|
442
|
+
def ==(o)
|
443
|
+
return true if self.equal?(o)
|
444
|
+
self.class == o.class &&
|
445
|
+
id == o.id &&
|
446
|
+
customer == o.customer &&
|
447
|
+
customer_id == o.customer_id &&
|
448
|
+
contact == o.contact &&
|
449
|
+
phone == o.phone &&
|
450
|
+
email == o.email &&
|
451
|
+
default_account == o.default_account &&
|
452
|
+
skip_quote == o.skip_quote &&
|
453
|
+
billing_address == o.billing_address &&
|
454
|
+
shipping_address == o.shipping_address &&
|
455
|
+
shipping_notes == o.shipping_notes &&
|
456
|
+
base_currency == o.base_currency &&
|
457
|
+
customer_currency == o.customer_currency &&
|
458
|
+
tax_rule == o.tax_rule &&
|
459
|
+
tax_calculation == o.tax_calculation &&
|
460
|
+
terms == o.terms &&
|
461
|
+
price_tier == o.price_tier &&
|
462
|
+
ship_by == o.ship_by &&
|
463
|
+
location == o.location &&
|
464
|
+
sale_order_date == o.sale_order_date &&
|
465
|
+
last_modified_on == o.last_modified_on &&
|
466
|
+
note == o.note &&
|
467
|
+
customer_reference == o.customer_reference &&
|
468
|
+
cogs_amount == o.cogs_amount &&
|
469
|
+
status == o.status &&
|
470
|
+
combined_picking_status == o.combined_picking_status &&
|
471
|
+
combined_packing_status == o.combined_packing_status &&
|
472
|
+
combined_shipping_status == o.combined_shipping_status &&
|
473
|
+
ful_filment_status == o.ful_filment_status &&
|
474
|
+
combined_invoice_status == o.combined_invoice_status &&
|
475
|
+
combined_payment_status == o.combined_payment_status &&
|
476
|
+
combined_tracking_numbers == o.combined_tracking_numbers &&
|
477
|
+
carrier == o.carrier &&
|
478
|
+
currency_rate == o.currency_rate &&
|
479
|
+
sales_representative == o.sales_representative &&
|
480
|
+
type == o.type &&
|
481
|
+
source_channel == o.source_channel &&
|
482
|
+
external_id == o.external_id &&
|
483
|
+
service_only == o.service_only &&
|
484
|
+
quote == o.quote &&
|
485
|
+
order == o.order &&
|
486
|
+
invoices == o.invoices
|
487
|
+
end
|
488
|
+
|
489
|
+
# @see the `==` method
|
490
|
+
# @param [Object] Object to be compared
|
491
|
+
def eql?(o)
|
492
|
+
self == o
|
493
|
+
end
|
494
|
+
|
495
|
+
# Calculates hash code according to all attributes.
|
496
|
+
# @return [Integer] Hash code
|
497
|
+
def hash
|
498
|
+
[id, customer, customer_id, contact, phone, email, default_account, skip_quote, billing_address, shipping_address, shipping_notes, base_currency, customer_currency, tax_rule, tax_calculation, terms, price_tier, ship_by, location, sale_order_date, last_modified_on, note, customer_reference, cogs_amount, status, combined_picking_status, combined_packing_status, combined_shipping_status, ful_filment_status, combined_invoice_status, combined_payment_status, combined_tracking_numbers, carrier, currency_rate, sales_representative, type, source_channel, external_id, service_only, quote, order, invoices].hash
|
499
|
+
end
|
500
|
+
|
501
|
+
# Builds the object from hash
|
502
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
503
|
+
# @return [Object] Returns the model itself
|
504
|
+
def self.build_from_hash(attributes)
|
505
|
+
new.build_from_hash(attributes)
|
506
|
+
end
|
507
|
+
|
508
|
+
# Builds the object from hash
|
509
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
510
|
+
# @return [Object] Returns the model itself
|
511
|
+
def build_from_hash(attributes)
|
512
|
+
return nil unless attributes.is_a?(Hash)
|
513
|
+
self.class.openapi_types.each_pair do |key, type|
|
514
|
+
if type =~ /\AArray<(.*)>/i
|
515
|
+
# check to ensure the input is an array given that the attribute
|
516
|
+
# is documented as an array but the input is not
|
517
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
518
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
519
|
+
end
|
520
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
521
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
522
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
523
|
+
end
|
524
|
+
|
525
|
+
self
|
526
|
+
end
|
527
|
+
|
528
|
+
# Deserializes the data based on type
|
529
|
+
# @param string type Data type
|
530
|
+
# @param string value Value to be deserialized
|
531
|
+
# @return [Object] Deserialized data
|
532
|
+
def _deserialize(type, value)
|
533
|
+
case type.to_sym
|
534
|
+
when :DateTime
|
535
|
+
DateTime.parse(value)
|
536
|
+
when :Date
|
537
|
+
Date.parse(value)
|
538
|
+
when :String
|
539
|
+
value.to_s
|
540
|
+
when :Integer
|
541
|
+
value.to_i
|
542
|
+
when :Float
|
543
|
+
value.to_f
|
544
|
+
when :Boolean
|
545
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
546
|
+
true
|
547
|
+
else
|
548
|
+
false
|
549
|
+
end
|
550
|
+
when :Object
|
551
|
+
# generic object (usually a Hash), return directly
|
552
|
+
value
|
553
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
554
|
+
inner_type = Regexp.last_match[:inner_type]
|
555
|
+
value.map { |v| _deserialize(inner_type, v) }
|
556
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
557
|
+
k_type = Regexp.last_match[:k_type]
|
558
|
+
v_type = Regexp.last_match[:v_type]
|
559
|
+
{}.tap do |hash|
|
560
|
+
value.each do |k, v|
|
561
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
562
|
+
end
|
563
|
+
end
|
564
|
+
else # model
|
565
|
+
DearInventoryRuby.const_get(type).build_from_hash(value)
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
# Returns the string representation of the object
|
570
|
+
# @return [String] String presentation of the object
|
571
|
+
def to_s
|
572
|
+
to_hash.to_s
|
573
|
+
end
|
574
|
+
|
575
|
+
# to_body is an alias to to_hash (backward compatibility)
|
576
|
+
# @return [Hash] Returns the object in the form of hash
|
577
|
+
def to_body
|
578
|
+
to_hash
|
579
|
+
end
|
580
|
+
|
581
|
+
# Returns the object in the form of hash
|
582
|
+
# @return [Hash] Returns the object in the form of hash
|
583
|
+
def to_hash
|
584
|
+
hash = {}
|
585
|
+
self.class.attribute_map.each_pair do |attr, param|
|
586
|
+
value = self.send(attr)
|
587
|
+
if value.nil?
|
588
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
589
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
590
|
+
end
|
591
|
+
|
592
|
+
hash[param] = _to_hash(value)
|
593
|
+
end
|
594
|
+
hash
|
595
|
+
end
|
596
|
+
|
597
|
+
# Outputs non-array value in the form of hash
|
598
|
+
# For object, use to_hash. Otherwise, just return the value
|
599
|
+
# @param [Object] value Any valid value
|
600
|
+
# @return [Hash] Returns the value in the form of hash
|
601
|
+
def _to_hash(value)
|
602
|
+
if value.is_a?(Array)
|
603
|
+
value.compact.map { |v| _to_hash(v) }
|
604
|
+
elsif value.is_a?(Hash)
|
605
|
+
{}.tap do |hash|
|
606
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
607
|
+
end
|
608
|
+
elsif value.respond_to? :to_hash
|
609
|
+
value.to_hash
|
610
|
+
else
|
611
|
+
value
|
612
|
+
end
|
613
|
+
end
|
614
|
+
end
|
615
|
+
end
|
data/lib/dear-inventory-ruby.rb
CHANGED
@@ -31,6 +31,7 @@ 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'
|
34
35
|
require 'dear-inventory-ruby/models/sale_additional_charge'
|
35
36
|
require 'dear-inventory-ruby/models/sale_invoice'
|
36
37
|
require 'dear-inventory-ruby/models/sale_invoice_additional_charge'
|
data/spec/.DS_Store
ADDED
Binary file
|
@@ -266,6 +266,20 @@ describe 'InventoryApi' do
|
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
+
# unit tests for get_sale
|
270
|
+
# Allows you to retrieve the Sale
|
271
|
+
# @param [Hash] opts the optional parameters
|
272
|
+
# @option opts [String] :id Default is nil
|
273
|
+
# @option opts [Boolean] :combine_additional_charges Show additional charges in 'Lines' array
|
274
|
+
# @option opts [Boolean] :hide_inventory_movements Hide inventory movements (Default = false)
|
275
|
+
# @option opts [Boolean] :include_transactions Show related transactions (Default = false)
|
276
|
+
# @return [Sale]
|
277
|
+
describe 'get_sale test' do
|
278
|
+
it 'should work' do
|
279
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
269
283
|
# unit tests for get_sale_invoices
|
270
284
|
# Allows you to retrieve the sale invoices
|
271
285
|
# @param [Hash] opts the optional parameters
|
@@ -0,0 +1,287 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for DearInventoryRuby::Sale
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'Sale' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = DearInventoryRuby::Sale.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of Sale' do
|
31
|
+
it 'should create an instance of Sale' do
|
32
|
+
expect(@instance).to be_instance_of(DearInventoryRuby::Sale)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "id"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "customer"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "customer_id"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "contact"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'test attribute "phone"' do
|
60
|
+
it 'should work' do
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'test attribute "email"' do
|
66
|
+
it 'should work' do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'test attribute "default_account"' do
|
72
|
+
it 'should work' do
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'test attribute "skip_quote"' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'test attribute "billing_address"' do
|
84
|
+
it 'should work' do
|
85
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'test attribute "shipping_address"' do
|
90
|
+
it 'should work' do
|
91
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe 'test attribute "shipping_notes"' do
|
96
|
+
it 'should work' do
|
97
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe 'test attribute "base_currency"' do
|
102
|
+
it 'should work' do
|
103
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe 'test attribute "customer_currency"' do
|
108
|
+
it 'should work' do
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe 'test attribute "tax_rule"' do
|
114
|
+
it 'should work' do
|
115
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe 'test attribute "tax_calculation"' do
|
120
|
+
it 'should work' do
|
121
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'test attribute "terms"' do
|
126
|
+
it 'should work' do
|
127
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe 'test attribute "price_tier"' do
|
132
|
+
it 'should work' do
|
133
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe 'test attribute "ship_by"' do
|
138
|
+
it 'should work' do
|
139
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe 'test attribute "location"' do
|
144
|
+
it 'should work' do
|
145
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'test attribute "sale_order_date"' do
|
150
|
+
it 'should work' do
|
151
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe 'test attribute "last_modified_on"' do
|
156
|
+
it 'should work' do
|
157
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe 'test attribute "note"' do
|
162
|
+
it 'should work' do
|
163
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe 'test attribute "customer_reference"' do
|
168
|
+
it 'should work' do
|
169
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe 'test attribute "cogs_amount"' do
|
174
|
+
it 'should work' do
|
175
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe 'test attribute "status"' do
|
180
|
+
it 'should work' do
|
181
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe 'test attribute "combined_picking_status"' do
|
186
|
+
it 'should work' do
|
187
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe 'test attribute "combined_packing_status"' do
|
192
|
+
it 'should work' do
|
193
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe 'test attribute "combined_shipping_status"' do
|
198
|
+
it 'should work' do
|
199
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe 'test attribute "ful_filment_status"' do
|
204
|
+
it 'should work' do
|
205
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
describe 'test attribute "combined_invoice_status"' do
|
210
|
+
it 'should work' do
|
211
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe 'test attribute "combined_payment_status"' do
|
216
|
+
it 'should work' do
|
217
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe 'test attribute "combined_tracking_numbers"' do
|
222
|
+
it 'should work' do
|
223
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe 'test attribute "carrier"' do
|
228
|
+
it 'should work' do
|
229
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
describe 'test attribute "currency_rate"' do
|
234
|
+
it 'should work' do
|
235
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe 'test attribute "sales_representative"' do
|
240
|
+
it 'should work' do
|
241
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe 'test attribute "type"' do
|
246
|
+
it 'should work' do
|
247
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
describe 'test attribute "source_channel"' do
|
252
|
+
it 'should work' do
|
253
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe 'test attribute "external_id"' do
|
258
|
+
it 'should work' do
|
259
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
describe 'test attribute "service_only"' do
|
264
|
+
it 'should work' do
|
265
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
describe 'test attribute "quote"' do
|
270
|
+
it 'should work' do
|
271
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe 'test attribute "order"' do
|
276
|
+
it 'should work' do
|
277
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
describe 'test attribute "invoices"' do
|
282
|
+
it 'should work' do
|
283
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dear-inventory-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nhan Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- docs/PaymentTerms.md
|
100
100
|
- docs/PriceTier.md
|
101
101
|
- docs/PriceTiers.md
|
102
|
+
- docs/Sale.md
|
102
103
|
- docs/SaleAdditionalCharge.md
|
103
104
|
- docs/SaleInvoice.md
|
104
105
|
- docs/SaleInvoiceAdditionalCharge.md
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- lib/dear-inventory-ruby/models/payment_terms.rb
|
141
142
|
- lib/dear-inventory-ruby/models/price_tier.rb
|
142
143
|
- lib/dear-inventory-ruby/models/price_tiers.rb
|
144
|
+
- lib/dear-inventory-ruby/models/sale.rb
|
143
145
|
- lib/dear-inventory-ruby/models/sale_additional_charge.rb
|
144
146
|
- lib/dear-inventory-ruby/models/sale_invoice.rb
|
145
147
|
- lib/dear-inventory-ruby/models/sale_invoice_additional_charge.rb
|
@@ -162,6 +164,7 @@ files:
|
|
162
164
|
- lib/dear-inventory-ruby/models/webhook_type.rb
|
163
165
|
- lib/dear-inventory-ruby/models/webhooks.rb
|
164
166
|
- lib/dear-inventory-ruby/version.rb
|
167
|
+
- spec/.DS_Store
|
165
168
|
- spec/api/inventory_api_spec.rb
|
166
169
|
- spec/api_client_spec.rb
|
167
170
|
- spec/configuration_spec.rb
|
@@ -191,6 +194,7 @@ files:
|
|
191
194
|
- spec/models/sale_payment_spec.rb
|
192
195
|
- spec/models/sale_quote_line_spec.rb
|
193
196
|
- spec/models/sale_quote_spec.rb
|
197
|
+
- spec/models/sale_spec.rb
|
194
198
|
- spec/models/shipping_address_spec.rb
|
195
199
|
- spec/models/success_spec.rb
|
196
200
|
- spec/models/supplier_customer_address_spec.rb
|
@@ -224,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
228
|
- !ruby/object:Gem::Version
|
225
229
|
version: '0'
|
226
230
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
231
|
+
rubygems_version: 3.3.10
|
228
232
|
signing_key:
|
229
233
|
specification_version: 4
|
230
234
|
summary: DEAR Inventory Ruby SDK generated from DEAR-OpenAPI Spec 3.0 for https://inventory.dearsystems.com
|
@@ -251,6 +255,7 @@ test_files:
|
|
251
255
|
- spec/models/sale_invoice_delete_spec.rb
|
252
256
|
- spec/models/sale_payment_spec.rb
|
253
257
|
- spec/models/sale_additional_charge_spec.rb
|
258
|
+
- spec/models/sale_spec.rb
|
254
259
|
- spec/models/webhook_type_spec.rb
|
255
260
|
- spec/models/taxes_spec.rb
|
256
261
|
- spec/models/accounts_spec.rb
|