unleashed 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +48 -0
- data/lib/unleashed/client.rb +7 -1
- data/lib/unleashed/models/payment_term.rb +5 -0
- data/lib/unleashed/resources/customer_resource.rb +1 -1
- data/lib/unleashed/resources/payment_term_resource.rb +50 -0
- data/lib/unleashed/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cdea89c1db61c6f9af7c6c076d44b61c8c8b544700eaab32b2f0b7adba4f71e
|
4
|
+
data.tar.gz: a7f23ff31284340aab544858de1a1421bf46a060a550c0b5ff943644b09fcf21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9acacc13ac8da33f97fb58da6df5ea72a1f4a7d2b80d663e03e42d34db7542cc0b567c015f794597468aef3a36545bd1c769c04f374b1bb99aa9c85718d7e0f9
|
7
|
+
data.tar.gz: f9dcd61b442996136c02b2019c52d2d5f6d5eac5e83422e37becee4910aed7c25acb9278a1fac455ebc103fe4f742738c26cabedc4f18e6968bd275feb0198b8
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.1.11] - 2019-12-04
|
6
|
+
|
7
|
+
- Add `Payment Term`
|
8
|
+
- Update `Currency`
|
9
|
+
- Update README.md and CHANGELOG.md
|
10
|
+
|
11
|
+
## [0.1.10] - 2019-12-02
|
12
|
+
|
13
|
+
- Add creating `customer`.
|
14
|
+
- Add new model `Currency`
|
15
|
+
- Custom encoding of `Faraday`.
|
16
|
+
|
5
17
|
## [0.1.9] - 2019-11-29
|
6
18
|
|
7
19
|
- Add `attr_reader` attributes applying for all models.
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Unleashed
|
2
2
|
|
3
|
+
[![Join the chat at https://gitter.im/unleashed-ruby/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/unleashed-ruby/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/unleashed.svg)](https://badge.fury.io/rb/unleashed)
|
6
|
+
[![Build Status](https://travis-ci.org/nnhansg/unleashed-ruby.svg?branch=master)](https://travis-ci.org/nnhansg/unleashed-ruby)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/github/nnhansg/unleashed-ruby/badge.svg)](https://coveralls.io/github/nnhansg/unleashed-ruby)
|
8
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/e41f32cc2a422dcecbf7/maintainability)](https://codeclimate.com/github/nnhansg/unleashed-ruby/maintainability)
|
9
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/e41f32cc2a422dcecbf7/test_coverage)](https://codeclimate.com/github/nnhansg/unleashed-ruby/test_coverage)
|
10
|
+
|
3
11
|
Ruby gem for invoking Unleashedsoftware RESTful API [https://apidocs.unleashedsoftware.com](https://apidocs.unleashedsoftware.com)
|
4
12
|
|
5
13
|
## 1. Installation
|
@@ -234,6 +242,46 @@ client.invoices.first
|
|
234
242
|
client.invoices.last
|
235
243
|
```
|
236
244
|
|
245
|
+
### Currencies
|
246
|
+
|
247
|
+
#### Get all currencies
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
client.currencies.all
|
251
|
+
```
|
252
|
+
|
253
|
+
#### Get the first currency
|
254
|
+
|
255
|
+
```ruby
|
256
|
+
client.currencies.first
|
257
|
+
```
|
258
|
+
|
259
|
+
#### Get the last currency
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
client.currencies.last
|
263
|
+
```
|
264
|
+
|
265
|
+
### Payment Terms
|
266
|
+
|
267
|
+
#### Get all payment terms
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
client.payment_terms.all
|
271
|
+
```
|
272
|
+
|
273
|
+
#### Get the first payment term
|
274
|
+
|
275
|
+
```ruby
|
276
|
+
client.payment_terms.first
|
277
|
+
```
|
278
|
+
|
279
|
+
#### Get the last payment term
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
client.payment_terms.last
|
283
|
+
```
|
284
|
+
|
237
285
|
## 4. Contributing
|
238
286
|
|
239
287
|
1. Fork it [https://github.com/nnhansg/unleashed-ruby](https://github.com/nnhansg/unleashed-ruby)
|
data/lib/unleashed/client.rb
CHANGED
@@ -3,9 +3,13 @@ require_relative 'error'
|
|
3
3
|
require_relative 'models/base_model'
|
4
4
|
require_relative 'models/customer'
|
5
5
|
require_relative 'models/invoice'
|
6
|
+
require_relative 'models/currency'
|
7
|
+
require_relative 'models/payment_term'
|
6
8
|
require_relative 'resources/base_resource'
|
7
9
|
require_relative 'resources/customer_resource'
|
8
10
|
require_relative 'resources/invoice_resource'
|
11
|
+
require_relative 'resources/currency_resource'
|
12
|
+
require_relative 'resources/payment_term_resource'
|
9
13
|
require 'json'
|
10
14
|
require 'faraday'
|
11
15
|
|
@@ -111,7 +115,9 @@ module Unleashed
|
|
111
115
|
def self.resources
|
112
116
|
{
|
113
117
|
customers: CustomerResource,
|
114
|
-
invoices: InvoiceResource
|
118
|
+
invoices: InvoiceResource,
|
119
|
+
currencies: CurrencyResource,
|
120
|
+
payment_terms: PaymentTermResource
|
115
121
|
}
|
116
122
|
end
|
117
123
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Unleashed
|
2
|
+
# Resource for the PaymentTerms API
|
3
|
+
# The PaymentTerms resource allows PaymentTerms to be listed.
|
4
|
+
#
|
5
|
+
# @see https://apidocs.unleashedsoftware.com/PaymentTerms
|
6
|
+
class PaymentTermResource < BaseResource
|
7
|
+
def model
|
8
|
+
Unleashed::PaymentTerm
|
9
|
+
end
|
10
|
+
|
11
|
+
# List all payment_terms
|
12
|
+
# /PaymentTerms - also returns the first 200 payment_terms because page number 1 is the default.
|
13
|
+
#
|
14
|
+
# @param options [Hash] Optional options.
|
15
|
+
# @option options [Integer] :page_size Can ask for up to 200 payment_terms. default: 10
|
16
|
+
# @option options [Integer] :page Page index. default: 1
|
17
|
+
#
|
18
|
+
# @return [Array<Unleashed::PaymentTerm>] List all payment_terms.
|
19
|
+
def all(options = { page: 1, page_size: 10 })
|
20
|
+
response = JSON.parse(@client.get('PaymentTerms', options).body)
|
21
|
+
payment_terms = response.key?('Items') ? response['Items'] : []
|
22
|
+
payment_terms.map { |attributes| Unleashed::PaymentTerm.new(@client, attributes) }
|
23
|
+
end
|
24
|
+
|
25
|
+
# Get a first payment_term in all
|
26
|
+
#
|
27
|
+
# @return [Unleashed::PaymentTerm]
|
28
|
+
def first
|
29
|
+
all.first
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get a last payment_term in all
|
33
|
+
#
|
34
|
+
# @return [Unleashed::PaymentTerm]
|
35
|
+
def last
|
36
|
+
all.last
|
37
|
+
end
|
38
|
+
|
39
|
+
# Create a new payment_term
|
40
|
+
#
|
41
|
+
# @param attributes [Hash] PaymentTerm's attributes.
|
42
|
+
#
|
43
|
+
# @return [Unleashed::PaymentTerm]
|
44
|
+
def create(attributes)
|
45
|
+
id = attributes[:Guid].present? ? attributes[:Guid] : ''
|
46
|
+
response = JSON.parse(@client.post("PaymentTerms/#{id}", attributes).body)
|
47
|
+
Unleashed::PaymentTerm.new(@client, response)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/unleashed/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nhan Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -117,10 +117,12 @@ files:
|
|
117
117
|
- lib/unleashed/models/currency.rb
|
118
118
|
- lib/unleashed/models/customer.rb
|
119
119
|
- lib/unleashed/models/invoice.rb
|
120
|
+
- lib/unleashed/models/payment_term.rb
|
120
121
|
- lib/unleashed/resources/base_resource.rb
|
121
122
|
- lib/unleashed/resources/currency_resource.rb
|
122
123
|
- lib/unleashed/resources/customer_resource.rb
|
123
124
|
- lib/unleashed/resources/invoice_resource.rb
|
125
|
+
- lib/unleashed/resources/payment_term_resource.rb
|
124
126
|
- lib/unleashed/version.rb
|
125
127
|
- unleashed.gemspec
|
126
128
|
homepage: https://github.com/nnhansg/unleashed-ruby
|