unleashed 0.1.15 → 0.1.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 463d518bf60dce8a899f4e616d0b2ae0ec2ac76555fd575cd0dfa192eb412224
4
- data.tar.gz: 29778dc4c4361ab5eb12e99a455cc27ffa04b9fdbe1bd09f663956a2155ec1d6
3
+ metadata.gz: ee9407d6e3e388a6398ec1bffe7f40b9d2a8d8be94fe8dbab1a512c3bc1caad9
4
+ data.tar.gz: a64d9632f3fb0867ff1df15307563324be5b4983d35f76e6c23f5e3f8a9e5788
5
5
  SHA512:
6
- metadata.gz: '08a6480f14abac43480273813a643e37e109625e817cbf84bfcb830cc196714d05ffe68773ecf0abf24450146b4d43f60cebcd55dfd7e4a828a31c7ea4c54d6c'
7
- data.tar.gz: 2294e7540617305b2caa36b061a9644a5b1fc36b8d345fb8a612615f1107d116184b3ac6509b7d6224b27ddfde0d9248fe808abaa5ccaf6f93492a352a625573
6
+ metadata.gz: 8bd91eb660d49c5b88aa674063efe780ce9953fe1e206eb1fb855c9f5d665eb60a303896c710d2eb3b66601ac49cb979e72f7189e11eabca80bf45821ce11752
7
+ data.tar.gz: b2ab21634ee32dd4fa9ed61116ba566949475749f52f6dbd5783f80409fd9459b40937d5e53799aa6d4cbcb1acb93f867e217ac694e1a853491c85cbb5a4075b
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.16] - 2020-04-10
6
+
7
+ - Add new model `Company` and resources.
8
+ - Update README and separate it to some docs.
9
+
5
10
  ## [0.1.15] - 2020-02-26
6
11
 
7
12
  - Update and fix bugs for `client`, `currency`, `customer`, `invoice` resources.
data/README.md CHANGED
@@ -70,255 +70,15 @@ options = { api_id: ENV['UNLEASHED_API_ID'], api_key: ENV['UNLEASHED_API_KEY'] }
70
70
  client = Unleashed::Client.new(options)
71
71
  ```
72
72
 
73
- ### Customers
73
+ ## 4. Documentation for Models
74
74
 
75
- #### Create a new Customer
75
+ * [Unleashed::Company](docs/Company.md)
76
+ * [Unleashed::Currency](docs/Currency.md)
77
+ * [Unleashed::Customer](docs/Customer.md)
78
+ * [Unleashed::Invoice](docs/Invoice.md)
79
+ * [Unleashed::PaymentTerm](docs/PaymentTerm.md)
76
80
 
77
- ```ruby
78
- customer = client.customers.create_or_update(
79
- Guid: '59f21e05-07fe-4d9d-b460-a09db4c3caa9',
80
- Addresses: [
81
- {
82
- AddressType: 'Shipping',
83
- AddressName: 'Example Address',
84
- StreetAddress: 'Example Address',
85
- StreetAddress2: 'Example Address 2',
86
- Suburb: 'Example Suburb',
87
- City: 'Auckland',
88
- Region: 'Auckland',
89
- Country: 'New Zealand',
90
- PostalCode: '1061',
91
- IsDefault: false,
92
- DeliveryInstruction: 'Have a good day'
93
- }
94
- ],
95
- TaxCode: '',
96
- TaxRate: nil,
97
- CustomerCode: 'UnleashedCustomer',
98
- CustomerName: 'Unleashed Customer',
99
- GSTVATNumber: nil,
100
- BankName: nil,
101
- BankBranch: nil,
102
- BankAccount: nil,
103
- Website: nil,
104
- PhoneNumber: nil,
105
- FaxNumber: nil,
106
- MobileNumber: nil,
107
- DDINumber: nil,
108
- TollFreeNumber: nil,
109
- Email: nil,
110
- EmailCC: nil,
111
- Currency: {
112
- CurrencyCode: 'NZD',
113
- Description: 'New Zealand, Dollars',
114
- Guid: 'c33e4f50-e42b-40cd-9147-4d0e4657cd4d'
115
- },
116
- Notes: nil,
117
- Taxable: true,
118
- SalesPerson: nil,
119
- DiscountRate: 0.0000,
120
- PrintPackingSlipInsteadOfInvoice: false,
121
- PrintInvoice: false,
122
- StopCredit: false,
123
- Obsolete: false,
124
- XeroSalesAccount: nil,
125
- XeroCostOfGoodsAccount: nil,
126
- SellPriceTier: '',
127
- SellPriceTierReference: nil,
128
- CustomerType: 'Cash',
129
- PaymentTerm: '20th Month following',
130
- ContactFirstName: nil,
131
- ContactLastName: nil
132
- )
133
- ```
134
-
135
- #### Update a Customer
136
-
137
- ```ruby
138
- customer = client.customers.update(
139
- Guid: '59f21e05-07fe-4d9d-b460-a09db4c3caa9',
140
- Addresses: [
141
- {
142
- AddressType: 'Shipping',
143
- AddressName: 'Example Address',
144
- StreetAddress: 'Example Address',
145
- StreetAddress2: 'Example Address 2',
146
- Suburb: 'Example Suburb',
147
- City: 'Auckland',
148
- Region: 'Auckland',
149
- Country: 'New Zealand',
150
- PostalCode: '1061',
151
- IsDefault: false,
152
- DeliveryInstruction: 'Have a good day'
153
- }
154
- ],
155
- TaxCode: '',
156
- TaxRate: nil,
157
- CustomerCode: 'UnleashedCustomer',
158
- CustomerName: 'Unleashed Customer',
159
- GSTVATNumber: nil,
160
- BankName: nil,
161
- BankBranch: nil,
162
- BankAccount: nil,
163
- Website: nil,
164
- PhoneNumber: nil,
165
- FaxNumber: nil,
166
- MobileNumber: nil,
167
- DDINumber: nil,
168
- TollFreeNumber: nil,
169
- Email: nil,
170
- EmailCC: nil,
171
- Currency: {
172
- CurrencyCode: 'NZD',
173
- Description: 'New Zealand, Dollars',
174
- Guid: '6cb5d67a-1c96-4fa8-bf59-b23c2d69f22a'
175
- },
176
- Notes: nil,
177
- Taxable: true,
178
- SalesPerson: nil,
179
- DiscountRate: 0.0000,
180
- PrintPackingSlipInsteadOfInvoice: false,
181
- PrintInvoice: false,
182
- StopCredit: false,
183
- Obsolete: false,
184
- XeroSalesAccount: nil,
185
- XeroCostOfGoodsAccount: nil,
186
- SellPriceTier: '',
187
- SellPriceTierReference: nil,
188
- CustomerType: 'Cash',
189
- PaymentTerm: '20th Month following',
190
- ContactFirstName: nil,
191
- ContactLastName: nil
192
- )
193
- ```
194
-
195
- #### Get all customers
196
-
197
- ```ruby
198
- # List all customers
199
- # /Customers - also returns the first 200 customers because page number 1 is the default.
200
- #
201
- # @param options [Hash] Optional options.
202
- # @option PageSize: Can ask for up to 200 customers. Default: 200
203
- # @option Page: Page index. Default: 1
204
- # @option CustomerType: Only returns customers that matches the specified customer type.
205
- # @option SellPriceTier: Only returns customers that are assigned to the specified sell price tier.
206
- # @option Currency: Only returns customers with currency code exactly matching the specified value.
207
- # @option Customer: Returns customers whose customer code or customer name contains the specified value. It is case-sensitive.
208
- # @option CustomerCode: Only returns customers that start with the specific customer code.
209
- # @option CustomerName: Only returns customers that start with the specific customer name.
210
- # @option ContactEmail: Only returns customers that have a contact email that starts with the specified email address.
211
- # @option ModifiedSince: Only returns customers modified since a specified date.
212
- # @option IncludeObsolete: Returns all customers, including obsolete, if set to `true`. If set to `false` or if it is not specified then returns only active (ie. non-obsolete) customers.
213
- # @option XeroContactId: Only returns customers that start with the specific Xero Contact Id.
214
- # @option OrderBy: Orders the list by `LastModifiedOn` or `CreatedOn` date. By default the list is ordered by `CustomerCode`.
215
- # @option Sort: Orders the list by `CreatedOn` date sorted in ascending or descending order.
216
- #
217
- # @return [Array<Unleashed::Customer>] List all customers.
218
- client.customers.all
219
- ```
220
-
221
- #### Get a customer
222
-
223
- ```ruby
224
- client.customers.find('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
225
- ```
226
-
227
- #### Get the first customer
228
-
229
- ```ruby
230
- client.customers.first
231
- ```
232
-
233
- #### Get the last customer
234
-
235
- ```ruby
236
- client.customers.last
237
- ```
238
-
239
- ### Invoices
240
-
241
- #### Get all invoices
242
-
243
- ```ruby
244
- # List all invoices
245
- # /Invoices - also returns the first 200 invoices because page number 1 is the default.
246
- #
247
- # @param options [Hash] Optional options.
248
- # @option Page: Page index. Default: 1
249
- # @option PageSize: Specifies the page size for pagination. Default page size is 200 invoices.
250
- # @option CustomerCode: Returns invoices that matches the specific customer code.
251
- # @option StartDate: Returns invoices created after a specified date, must be UTC format.
252
- # @option EndDate: Returns invoices created before a specified date, must be UTC format.
253
- # @option ModifiedSince: Returns invoices created or edited after a specified date, must be UTC format.
254
- # @option OrderNumber: Returns the invoices associated with the Sales Order Number.
255
- # @option InvoiceNumber: Returns a single invoice with the specified invoice number. If set, it overrides all other filters.
256
- # @option InvoiceStatus: Returns invoices with the specified status. Multiple selection can be specified as comma separated.For example: `invoiceStatus=Completed,Parked`. If no invoiceStatus filter is specified, then we exclude “Deleted” by default.
257
- # @option SerialBatch: False by default. If set to true then the attributes SerialNumbers and BatchNumbers are displayed.
258
- #
259
- # @return [Array<Unleashed::Invoice>] List all invoices.
260
- client.invoices.all
261
- ```
262
-
263
- #### Get an invoice
264
-
265
- ```ruby
266
- client.invoices.find('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
267
- ```
268
-
269
- #### Get the first invoice
270
-
271
- ```ruby
272
- client.invoices.first
273
- ```
274
-
275
- #### Get the last invoice
276
-
277
- ```ruby
278
- client.invoices.last
279
- ```
280
-
281
- ### Currencies
282
-
283
- #### Get all currencies
284
-
285
- ```ruby
286
- client.currencies.all
287
- ```
288
-
289
- #### Get the first currency
290
-
291
- ```ruby
292
- client.currencies.first
293
- ```
294
-
295
- #### Get the last currency
296
-
297
- ```ruby
298
- client.currencies.last
299
- ```
300
-
301
- ### Payment Terms
302
-
303
- #### Get all payment terms
304
-
305
- ```ruby
306
- client.payment_terms.all
307
- ```
308
-
309
- #### Get the first payment term
310
-
311
- ```ruby
312
- client.payment_terms.first
313
- ```
314
-
315
- #### Get the last payment term
316
-
317
- ```ruby
318
- client.payment_terms.last
319
- ```
320
-
321
- ## 4. Contributing
81
+ ## 5. Contributing
322
82
 
323
83
  1. Fork it [https://github.com/nnhansg/unleashed-ruby](https://github.com/nnhansg/unleashed-ruby)
324
84
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -326,10 +86,10 @@ client.payment_terms.last
326
86
  4. Push to the branch (`git push origin my-new-feature`)
327
87
  5. Create a new Pull Request
328
88
 
329
- ## 5. License
89
+ ## 6. License
330
90
 
331
91
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
332
92
 
333
- ## 6. Code of Conduct
93
+ ## 7. Code of Conduct
334
94
 
335
95
  Everyone interacting in the Unleashed project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nnhansg/unleashed-ruby/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,19 @@
1
+ # Unleashed::Company
2
+
3
+ ## Get all companies
4
+
5
+ ```ruby
6
+ client.companies.all
7
+ ```
8
+
9
+ ## Get the first company
10
+
11
+ ```ruby
12
+ client.companies.first
13
+ ```
14
+
15
+ ## Get the last company
16
+
17
+ ```ruby
18
+ client.companies.last
19
+ ```
@@ -0,0 +1,19 @@
1
+ # Unleashed::Currency
2
+
3
+ ## Get all currencies
4
+
5
+ ```ruby
6
+ client.currencies.all
7
+ ```
8
+
9
+ ## Get the first currency
10
+
11
+ ```ruby
12
+ client.currencies.first
13
+ ```
14
+
15
+ ## Get the last currency
16
+
17
+ ```ruby
18
+ client.currencies.last
19
+ ```
@@ -0,0 +1,165 @@
1
+ # Unleashed::Customer
2
+
3
+ ## Create a new Customer
4
+
5
+ ```ruby
6
+ customer = client.customers.create_or_update(
7
+ Guid: '59f21e05-07fe-4d9d-b460-a09db4c3caa9',
8
+ Addresses: [
9
+ {
10
+ AddressType: 'Shipping',
11
+ AddressName: 'Example Address',
12
+ StreetAddress: 'Example Address',
13
+ StreetAddress2: 'Example Address 2',
14
+ Suburb: 'Example Suburb',
15
+ City: 'Auckland',
16
+ Region: 'Auckland',
17
+ Country: 'New Zealand',
18
+ PostalCode: '1061',
19
+ IsDefault: false,
20
+ DeliveryInstruction: 'Have a good day'
21
+ }
22
+ ],
23
+ TaxCode: '',
24
+ TaxRate: nil,
25
+ CustomerCode: 'UnleashedCustomer',
26
+ CustomerName: 'Unleashed Customer',
27
+ GSTVATNumber: nil,
28
+ BankName: nil,
29
+ BankBranch: nil,
30
+ BankAccount: nil,
31
+ Website: nil,
32
+ PhoneNumber: nil,
33
+ FaxNumber: nil,
34
+ MobileNumber: nil,
35
+ DDINumber: nil,
36
+ TollFreeNumber: nil,
37
+ Email: nil,
38
+ EmailCC: nil,
39
+ Currency: {
40
+ CurrencyCode: 'NZD',
41
+ Description: 'New Zealand, Dollars',
42
+ Guid: 'c33e4f50-e42b-40cd-9147-4d0e4657cd4d'
43
+ },
44
+ Notes: nil,
45
+ Taxable: true,
46
+ SalesPerson: nil,
47
+ DiscountRate: 0.0000,
48
+ PrintPackingSlipInsteadOfInvoice: false,
49
+ PrintInvoice: false,
50
+ StopCredit: false,
51
+ Obsolete: false,
52
+ XeroSalesAccount: nil,
53
+ XeroCostOfGoodsAccount: nil,
54
+ SellPriceTier: '',
55
+ SellPriceTierReference: nil,
56
+ CustomerType: 'Cash',
57
+ PaymentTerm: '20th Month following',
58
+ ContactFirstName: nil,
59
+ ContactLastName: nil
60
+ )
61
+ ```
62
+
63
+ ## Update a Customer
64
+
65
+ ```ruby
66
+ customer = client.customers.update(
67
+ Guid: '59f21e05-07fe-4d9d-b460-a09db4c3caa9',
68
+ Addresses: [
69
+ {
70
+ AddressType: 'Shipping',
71
+ AddressName: 'Example Address',
72
+ StreetAddress: 'Example Address',
73
+ StreetAddress2: 'Example Address 2',
74
+ Suburb: 'Example Suburb',
75
+ City: 'Auckland',
76
+ Region: 'Auckland',
77
+ Country: 'New Zealand',
78
+ PostalCode: '1061',
79
+ IsDefault: false,
80
+ DeliveryInstruction: 'Have a good day'
81
+ }
82
+ ],
83
+ TaxCode: '',
84
+ TaxRate: nil,
85
+ CustomerCode: 'UnleashedCustomer',
86
+ CustomerName: 'Unleashed Customer',
87
+ GSTVATNumber: nil,
88
+ BankName: nil,
89
+ BankBranch: nil,
90
+ BankAccount: nil,
91
+ Website: nil,
92
+ PhoneNumber: nil,
93
+ FaxNumber: nil,
94
+ MobileNumber: nil,
95
+ DDINumber: nil,
96
+ TollFreeNumber: nil,
97
+ Email: nil,
98
+ EmailCC: nil,
99
+ Currency: {
100
+ CurrencyCode: 'NZD',
101
+ Description: 'New Zealand, Dollars',
102
+ Guid: '6cb5d67a-1c96-4fa8-bf59-b23c2d69f22a'
103
+ },
104
+ Notes: nil,
105
+ Taxable: true,
106
+ SalesPerson: nil,
107
+ DiscountRate: 0.0000,
108
+ PrintPackingSlipInsteadOfInvoice: false,
109
+ PrintInvoice: false,
110
+ StopCredit: false,
111
+ Obsolete: false,
112
+ XeroSalesAccount: nil,
113
+ XeroCostOfGoodsAccount: nil,
114
+ SellPriceTier: '',
115
+ SellPriceTierReference: nil,
116
+ CustomerType: 'Cash',
117
+ PaymentTerm: '20th Month following',
118
+ ContactFirstName: nil,
119
+ ContactLastName: nil
120
+ )
121
+ ```
122
+
123
+ ## Get all customers
124
+
125
+ ```ruby
126
+ # List all customers
127
+ # /Customers - also returns the first 200 customers because page number 1 is the default.
128
+ #
129
+ # @param options [Hash] Optional options.
130
+ # @option PageSize: Can ask for up to 200 customers. Default: 200
131
+ # @option Page: Page index. Default: 1
132
+ # @option CustomerType: Only returns customers that matches the specified customer type.
133
+ # @option SellPriceTier: Only returns customers that are assigned to the specified sell price tier.
134
+ # @option Currency: Only returns customers with currency code exactly matching the specified value.
135
+ # @option Customer: Returns customers whose customer code or customer name contains the specified value. It is case-sensitive.
136
+ # @option CustomerCode: Only returns customers that start with the specific customer code.
137
+ # @option CustomerName: Only returns customers that start with the specific customer name.
138
+ # @option ContactEmail: Only returns customers that have a contact email that starts with the specified email address.
139
+ # @option ModifiedSince: Only returns customers modified since a specified date.
140
+ # @option IncludeObsolete: Returns all customers, including obsolete, if set to `true`. If set to `false` or if it is not specified then returns only active (ie. non-obsolete) customers.
141
+ # @option XeroContactId: Only returns customers that start with the specific Xero Contact Id.
142
+ # @option OrderBy: Orders the list by `LastModifiedOn` or `CreatedOn` date. By default the list is ordered by `CustomerCode`.
143
+ # @option Sort: Orders the list by `CreatedOn` date sorted in ascending or descending order.
144
+ #
145
+ # @return [Array<Unleashed::Customer>] List all customers.
146
+ client.customers.all
147
+ ```
148
+
149
+ ## Get a customer
150
+
151
+ ```ruby
152
+ client.customers.find('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
153
+ ```
154
+
155
+ ## Get the first customer
156
+
157
+ ```ruby
158
+ client.customers.first
159
+ ```
160
+
161
+ ## Get the last customer
162
+
163
+ ```ruby
164
+ client.customers.last
165
+ ```
@@ -0,0 +1,41 @@
1
+ # Invoices
2
+
3
+ ## Get all invoices
4
+
5
+ ```ruby
6
+ # List all invoices
7
+ # /Invoices - also returns the first 200 invoices because page number 1 is the default.
8
+ #
9
+ # @param options [Hash] Optional options.
10
+ # @option Page: Page index. Default: 1
11
+ # @option PageSize: Specifies the page size for pagination. Default page size is 200 invoices.
12
+ # @option CustomerCode: Returns invoices that matches the specific customer code.
13
+ # @option StartDate: Returns invoices created after a specified date, must be UTC format.
14
+ # @option EndDate: Returns invoices created before a specified date, must be UTC format.
15
+ # @option ModifiedSince: Returns invoices created or edited after a specified date, must be UTC format.
16
+ # @option OrderNumber: Returns the invoices associated with the Sales Order Number.
17
+ # @option InvoiceNumber: Returns a single invoice with the specified invoice number. If set, it overrides all other filters.
18
+ # @option InvoiceStatus: Returns invoices with the specified status. Multiple selection can be specified as comma separated.For example: `invoiceStatus=Completed,Parked`. If no invoiceStatus filter is specified, then we exclude “Deleted” by default.
19
+ # @option SerialBatch: False by default. If set to true then the attributes SerialNumbers and BatchNumbers are displayed.
20
+ #
21
+ # @return [Array<Unleashed::Invoice>] List all invoices.
22
+ client.invoices.all
23
+ ```
24
+
25
+ ## Get an invoice
26
+
27
+ ```ruby
28
+ client.invoices.find('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
29
+ ```
30
+
31
+ ## Get the first invoice
32
+
33
+ ```ruby
34
+ client.invoices.first
35
+ ```
36
+
37
+ ## Get the last invoice
38
+
39
+ ```ruby
40
+ client.invoices.last
41
+ ```
@@ -0,0 +1,19 @@
1
+ # Payment Terms
2
+
3
+ ## Get all payment terms
4
+
5
+ ```ruby
6
+ client.payment_terms.all
7
+ ```
8
+
9
+ ## Get the first payment term
10
+
11
+ ```ruby
12
+ client.payment_terms.first
13
+ ```
14
+
15
+ ## Get the last payment term
16
+
17
+ ```ruby
18
+ client.payment_terms.last
19
+ ```
@@ -5,11 +5,13 @@ require_relative 'models/customer'
5
5
  require_relative 'models/invoice'
6
6
  require_relative 'models/currency'
7
7
  require_relative 'models/payment_term'
8
+ require_relative 'models/company'
8
9
  require_relative 'resources/base_resource'
9
10
  require_relative 'resources/customer_resource'
10
11
  require_relative 'resources/invoice_resource'
11
12
  require_relative 'resources/currency_resource'
12
13
  require_relative 'resources/payment_term_resource'
14
+ require_relative 'resources/company_resource'
13
15
  require 'json'
14
16
  require 'faraday'
15
17
 
@@ -131,7 +133,8 @@ module Unleashed
131
133
  customers: CustomerResource,
132
134
  invoices: InvoiceResource,
133
135
  currencies: CurrencyResource,
134
- payment_terms: PaymentTermResource
136
+ payment_terms: PaymentTermResource,
137
+ companies: CompanyResource
135
138
  }
136
139
  end
137
140
 
@@ -0,0 +1,5 @@
1
+ module Unleashed
2
+ # Manage Companies
3
+ class Company < BaseModel
4
+ end
5
+ end
@@ -0,0 +1,38 @@
1
+ module Unleashed
2
+ # The Companies resource allows Companies to be listed. An individual Company details can be
3
+ # viewed by appending its identifier (a GUID formatted as XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
4
+ # to the URI. Here are some example URIs:
5
+ # /Companies - returns a list of Company related information.
6
+ #
7
+ # @see https://apidocs.unleashedsoftware.com/Companies
8
+ class CompanyResource < BaseResource
9
+ def model
10
+ Unleashed::Company
11
+ end
12
+
13
+ # Lists all information for your company
14
+ # /Companies - returns a list of Company related information.
15
+ #
16
+ # @return [Array<Unleashed::Company>] Lists all information for your company.
17
+ def all
18
+ endpoint = 'Companies'
19
+ response = JSON.parse(@client.get(endpoint).body)
20
+ companies = response.key?('Items') ? response['Items'] : []
21
+ companies.map { |attributes| Unleashed::Company.new(@client, attributes) }
22
+ end
23
+
24
+ # Get a first company in all
25
+ #
26
+ # @return [Unleashed::Company]
27
+ def first
28
+ all.first
29
+ end
30
+
31
+ # Get a last company in all
32
+ #
33
+ # @return [Unleashed::Company]
34
+ def last
35
+ all.last
36
+ end
37
+ end
38
+ end
@@ -35,10 +35,7 @@ module Unleashed
35
35
  params = options.dup
36
36
 
37
37
  # Handle Page option
38
- if params[:Page].present?
39
- endpoint << "/#{params[:Page]}"
40
- end
41
-
38
+ endpoint << "/#{params[:Page]}" if params[:Page].present?
42
39
  response = JSON.parse(@client.get(endpoint, params).body)
43
40
  customers = response.key?('Items') ? response['Items'] : []
44
41
  customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }
@@ -66,10 +66,7 @@ module Unleashed
66
66
  params = options.dup
67
67
 
68
68
  # Handle Page option
69
- if params[:Page].present?
70
- endpoint << "/#{params[:Page]}"
71
- end
72
-
69
+ endpoint << "/#{params[:Page]}" if params[:Page].present?
73
70
  response = JSON.parse(@client.get(endpoint, params).body)
74
71
  invoices = response.key?('Items') ? response['Items'] : []
75
72
  invoices.map { |attributes| Unleashed::Invoice.new(@client, attributes) }
@@ -2,7 +2,7 @@ module Unleashed
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 15
5
+ TINY = 16
6
6
 
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}".freeze
8
8
  end
@@ -13,15 +13,6 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/nnhansg/unleashed-ruby'
14
14
  spec.license = 'MIT'
15
15
 
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- # if spec.respond_to?(:metadata)
19
- # spec.metadata['allowed_push_host'] = 'https://github.com'
20
- # else
21
- # raise 'RubyGems 2.0 or newer is required to protect against ' \
22
- # 'public gem pushes.'
23
- # end
24
-
25
16
  spec.metadata['homepage_uri'] = spec.homepage
26
17
  spec.metadata['source_code_uri'] = 'https://github.com/nnhansg/unleashed-ruby/src/master/'
27
18
  spec.metadata['changelog_uri'] = 'https://github.com/nnhansg/unleashed-ruby/src/master/CHANGELOG.md'
@@ -43,6 +34,6 @@ Gem::Specification.new do |spec|
43
34
  spec.add_dependency 'faraday', '>= 0'
44
35
  spec.add_dependency 'json', '>= 0'
45
36
  spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.1'
46
- spec.add_development_dependency 'rake', '~> 10.0'
37
+ spec.add_development_dependency 'rake', '>= 12.3.3'
47
38
  spec.add_development_dependency 'rspec', '~> 3.0'
48
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleashed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nhan Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -62,16 +62,16 @@ dependencies:
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '10.0'
67
+ version: 12.3.3
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '10.0'
74
+ version: 12.3.3
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,11 @@ files:
107
107
  - bin/.keep
108
108
  - bin/console
109
109
  - bin/setup
110
+ - docs/Company.md
111
+ - docs/Currency.md
112
+ - docs/Customer.md
113
+ - docs/Invoice.md
114
+ - docs/PaymentTerm.md
110
115
  - lib/.keep
111
116
  - lib/unleashed.rb
112
117
  - lib/unleashed/client.rb
@@ -114,11 +119,13 @@ files:
114
119
  - lib/unleashed/default.rb
115
120
  - lib/unleashed/error.rb
116
121
  - lib/unleashed/models/base_model.rb
122
+ - lib/unleashed/models/company.rb
117
123
  - lib/unleashed/models/currency.rb
118
124
  - lib/unleashed/models/customer.rb
119
125
  - lib/unleashed/models/invoice.rb
120
126
  - lib/unleashed/models/payment_term.rb
121
127
  - lib/unleashed/resources/base_resource.rb
128
+ - lib/unleashed/resources/company_resource.rb
122
129
  - lib/unleashed/resources/currency_resource.rb
123
130
  - lib/unleashed/resources/customer_resource.rb
124
131
  - lib/unleashed/resources/invoice_resource.rb