jortt 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/README.md +12 -14
- data/jortt.gemspec +18 -7
- data/lib/jortt.rb +22 -0
- data/lib/{freemle → jortt}/client.rb +15 -15
- data/lib/{freemle → jortt}/client/resource.rb +7 -7
- data/lib/jortt/client/version.rb +7 -0
- data/spec/freemle_spec.rb +1 -1
- data/spec/{freemle → jortt}/client/resource_spec.rb +1 -1
- data/spec/{freemle → jortt}/client_spec.rb +1 -1
- data/spec/spec_helper.rb +6 -8
- metadata +33 -17
- data/lib/freemle.rb +0 -22
- data/lib/freemle/client/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08466fe7b01ea7758a6fecfecb4851ca0a4b091b
|
4
|
+
data.tar.gz: dfad854f25b7303b2015831b8b9aceb9f7e727ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 499973d4e8032da74eba391c06d95ab62f298567b5cb50a9957e10a0e70f23e664501e5b34fbece628b1bbf88a59d54532bbcd7a20ec9def573f91783f44e2ad
|
7
|
+
data.tar.gz: c9522fd7d8485e967d14dce03d153b726a8459557ca616df9fcc0bc2de45d3fa484827e8c41385c119143dc6f400d4b34a6c2e3909b5ec4f509f1485b1e893b0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# Jortt REST API client
|
2
2
|
|
3
3
|
[![Inline docs](
|
4
|
-
http://inch-ci.org/github/jorttbv/
|
4
|
+
http://inch-ci.org/github/jorttbv/jortt-ruby.svg?branch=master&style=flat
|
5
5
|
)](http://inch-ci.org/github/jorttbv/jortt-ruby)
|
6
6
|
[![Code Climate](
|
7
7
|
http://img.shields.io/codeclimate/github/jorttbv/jortt-ruby.svg?style=flat
|
8
8
|
)](https://codeclimate.com/github/jorttbv/jortt-ruby)
|
9
|
-
[![Coverage
|
10
|
-
|
11
|
-
)](https://
|
9
|
+
[![Code Coverage](
|
10
|
+
https://codecov.io/github/jorttbv/jortt-ruby/coverage.svg?branch=master
|
11
|
+
)](https://codecov.io/github/jorttbv/jortt-ruby?branch=master)
|
12
12
|
[![Build Status](
|
13
13
|
http://img.shields.io/travis/jorttbv/jortt-ruby.svg?style=flat
|
14
14
|
)](https://travis-ci.org/jorttbv/jortt-ruby)
|
@@ -17,11 +17,9 @@ A Ruby interface to the [Jortt](https://www.jortt.nl/) REST API.
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
To create a freemle client:
|
20
|
+
To create a jortt client:
|
23
21
|
```ruby
|
24
|
-
|
22
|
+
jortt = Jortt.client(
|
25
23
|
app_name: "application-name-as-chosen-on-jortt.nl",
|
26
24
|
api_key: "api-key-as-provided-by-jortt.nl"
|
27
25
|
)
|
@@ -29,7 +27,7 @@ freemle = Freemle.client(
|
|
29
27
|
|
30
28
|
### Customers
|
31
29
|
|
32
|
-
Accessing customers (`
|
30
|
+
Accessing customers (`jortt.customers.search('Jortt')`) returns:
|
33
31
|
```ruby
|
34
32
|
[{
|
35
33
|
company_name: 'Jortt',
|
@@ -50,7 +48,7 @@ Accessing customers (`freemle.customers.search('Jortt')`) returns:
|
|
50
48
|
|
51
49
|
Adding customers:
|
52
50
|
```ruby
|
53
|
-
|
51
|
+
jortt.customers.create(
|
54
52
|
company_name: "Jortt B.V.",
|
55
53
|
attn: "Vibiemme", # Optional
|
56
54
|
extra_information: "The best cofee maker!", # Optional
|
@@ -67,7 +65,7 @@ freemle.customers.create(
|
|
67
65
|
|
68
66
|
Adding invoices:
|
69
67
|
```ruby
|
70
|
-
|
68
|
+
jortt.invoices.create(
|
71
69
|
customer_id: "123456789", # Optional
|
72
70
|
delivery_period: "31-12-1234", # Optional
|
73
71
|
reference: "my-reference", # Optional
|
@@ -90,10 +88,10 @@ Check https://app.jortt.nl/api-documentatie for more info.
|
|
90
88
|
### Building the gem
|
91
89
|
|
92
90
|
`rake build` and then `rake install` to test it locally (`irb` followed
|
93
|
-
by `require '
|
91
|
+
by `require 'jortt/client'` and do your stuff).
|
94
92
|
|
95
93
|
### Releasing the gem
|
96
94
|
|
97
95
|
Make a fix, commit and push. Make sure the build is green. Then bump the
|
98
|
-
version (edit `lib/
|
96
|
+
version (edit `lib/jortt/client/version.rb`). Now `rake release` and follow
|
99
97
|
the instructions (you need a rubygems.org account and permissions ;-)).
|
data/jortt.gemspec
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'jortt/client/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'jortt'
|
8
|
-
spec.version =
|
9
|
-
spec.authors = [
|
10
|
-
|
8
|
+
spec.version = Jortt::Client::VERSION
|
9
|
+
spec.authors = [
|
10
|
+
'Bob Forma',
|
11
|
+
'Steven Weller',
|
12
|
+
'Lars Vonk',
|
13
|
+
'Stephan van Diepen',
|
14
|
+
]
|
15
|
+
spec.email = [
|
16
|
+
'bforma@zilverline.com',
|
17
|
+
'suweller@zilverline.com',
|
18
|
+
'lvonk@zilverline.com',
|
19
|
+
'svdiepen@zilverline.com',
|
20
|
+
]
|
11
21
|
spec.summary = 'jortt.nl REST API client'
|
12
|
-
spec.homepage = 'https://
|
22
|
+
spec.homepage = 'https://app.jortt.nl/api-documentatie'
|
13
23
|
spec.license = 'MIT'
|
14
24
|
|
15
25
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -20,9 +30,10 @@ Gem::Specification.new do |spec|
|
|
20
30
|
spec.add_runtime_dependency 'rest-client', '~> 1.6'
|
21
31
|
|
22
32
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
23
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'codecov', '~> 0.1'
|
24
34
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'rspec', '~>
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
36
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2.0'
|
26
37
|
spec.add_development_dependency 'webmock', '~> 1.17'
|
27
38
|
spec.add_development_dependency 'rubocop', '~> 0.24.1'
|
28
39
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.1.0'
|
data/lib/jortt.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'jortt/client'
|
3
|
+
require 'jortt/client/version'
|
4
|
+
|
5
|
+
##
|
6
|
+
# This module contains everything needed to setup a connection to the Jortt
|
7
|
+
# API. It's only method returns a configured Jortt::Client.
|
8
|
+
module Jortt
|
9
|
+
|
10
|
+
# Convenient way to initialize a jortt client.
|
11
|
+
#
|
12
|
+
# @see {Jortt::Client.initialize}
|
13
|
+
#
|
14
|
+
# @return [ Jortt::Client ] a new jortt client instance
|
15
|
+
#
|
16
|
+
# @since 1.0.1
|
17
|
+
def client(*args)
|
18
|
+
Jortt::Client.new(*args)
|
19
|
+
end
|
20
|
+
module_function :client
|
21
|
+
|
22
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require '
|
2
|
+
require 'jortt/client/resource'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Jortt
|
5
5
|
##
|
6
|
-
# This class is the main interface used to communicate with the
|
7
|
-
# It is by the {
|
6
|
+
# This class is the main interface used to communicate with the Jortt API.
|
7
|
+
# It is by the {Jortt} module to create configured instances.
|
8
8
|
class Client
|
9
|
-
BASE_URL = 'https://
|
9
|
+
BASE_URL = 'https://app.jortt.nl/api'
|
10
10
|
|
11
11
|
attr_accessor :base_url, :app_name, :api_key
|
12
12
|
|
13
|
-
# Initialize a
|
13
|
+
# Initialize a Jortt client.
|
14
14
|
#
|
15
15
|
# @example
|
16
|
-
#
|
17
|
-
# app_name: <application-name, chosen in
|
18
|
-
# api_key: <api-key, as provided by
|
16
|
+
# Jortt::Client.new(
|
17
|
+
# app_name: <application-name, chosen in jortt.nl>
|
18
|
+
# api_key: <api-key, as provided by jortt.nl>
|
19
19
|
# )
|
20
20
|
#
|
21
21
|
# @params [ Hash ] opts Options for the client,
|
22
22
|
# optionally including base_url.
|
23
23
|
#
|
24
|
-
# @return [
|
24
|
+
# @return [ Jortt::Client ]
|
25
25
|
#
|
26
26
|
# @since 1.0.0
|
27
27
|
def initialize(opts)
|
@@ -35,7 +35,7 @@ module Freemle
|
|
35
35
|
# @example
|
36
36
|
# client.customers
|
37
37
|
#
|
38
|
-
# @return [
|
38
|
+
# @return [ Jortt::Client::Resource ] entry to the customer resource.
|
39
39
|
#
|
40
40
|
# @since 1.0.0
|
41
41
|
def customers
|
@@ -47,7 +47,7 @@ module Freemle
|
|
47
47
|
# @example
|
48
48
|
# client.invoices
|
49
49
|
#
|
50
|
-
# @return [
|
50
|
+
# @return [ Jortt::Client::Resource ] entry to the invoice resource.
|
51
51
|
#
|
52
52
|
# @since 1.0.0
|
53
53
|
def invoices
|
@@ -56,13 +56,13 @@ module Freemle
|
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
-
# Creates a
|
59
|
+
# Creates a jortt client resource based on the passed configuration
|
60
60
|
#
|
61
|
-
# @return [
|
61
|
+
# @return [ Jortt::Client::Resource ] entry to a resource.
|
62
62
|
#
|
63
63
|
# @since 1.0.1
|
64
64
|
def new_resource(*args)
|
65
|
-
|
65
|
+
Jortt::Client::Resource.new(*args)
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'rest-client'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Jortt # :nodoc:
|
5
5
|
class Client # :nodoc:
|
6
6
|
##
|
7
|
-
# This class is used by {
|
7
|
+
# This class is used by {Jortt::Client} internally.
|
8
8
|
# It wraps rest API calls of a single resource,
|
9
9
|
# so they can easily be used using the client DSL.
|
10
10
|
#
|
11
|
-
# @see {
|
11
|
+
# @see { Jortt::Client.customer }
|
12
12
|
class Resource
|
13
13
|
|
14
14
|
# Details needed to connect to this resource, see
|
15
|
-
# +
|
15
|
+
# +Jortt::Client#initialize+
|
16
16
|
#
|
17
17
|
# @since 1.0.0
|
18
18
|
attr_accessor :config
|
@@ -30,9 +30,9 @@ module Freemle # :nodoc:
|
|
30
30
|
|
31
31
|
# Creates a new resource instance.
|
32
32
|
#
|
33
|
-
# @see {
|
33
|
+
# @see { Jortt::Client#new_resource }
|
34
34
|
#
|
35
|
-
# @returns [
|
35
|
+
# @returns [ Jortt::Client::Resource ] bound to the resource
|
36
36
|
# defined by +singular+ & +plural+
|
37
37
|
#
|
38
38
|
# @since 1.0.0
|
@@ -63,7 +63,7 @@ module Freemle # :nodoc:
|
|
63
63
|
request.get(params: {query: query}, &block)
|
64
64
|
end
|
65
65
|
|
66
|
-
# Persists a resource on
|
66
|
+
# Persists a resource on app.jortt.nl, given a payload.
|
67
67
|
#
|
68
68
|
# @example
|
69
69
|
# customers.create(
|
data/spec/freemle_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
require 'simplecov'
|
3
|
-
require 'coveralls'
|
4
2
|
|
5
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
6
|
-
SimpleCov::Formatter::HTMLFormatter,
|
7
|
-
Coveralls::SimpleCov::Formatter
|
8
|
-
]
|
9
3
|
SimpleCov.start
|
10
|
-
|
4
|
+
if ENV['CI'] == 'true'
|
5
|
+
require 'codecov'
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
7
|
+
end
|
11
8
|
|
12
9
|
require 'rspec'
|
10
|
+
require 'rspec/its'
|
13
11
|
require 'webmock/rspec'
|
14
12
|
|
15
|
-
require '
|
13
|
+
require 'jortt'
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jortt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Forma
|
8
8
|
- Steven Weller
|
9
9
|
- Lars Vonk
|
10
|
+
- Stephan van Diepen
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rest-client
|
@@ -41,19 +42,19 @@ dependencies:
|
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '1.0'
|
43
44
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
45
|
+
name: codecov
|
45
46
|
requirement: !ruby/object:Gem::Requirement
|
46
47
|
requirements:
|
47
48
|
- - "~>"
|
48
49
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
50
|
+
version: '0.1'
|
50
51
|
type: :development
|
51
52
|
prerelease: false
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
53
54
|
requirements:
|
54
55
|
- - "~>"
|
55
56
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0.
|
57
|
+
version: '0.1'
|
57
58
|
- !ruby/object:Gem::Dependency
|
58
59
|
name: rake
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,14 +75,28 @@ dependencies:
|
|
74
75
|
requirements:
|
75
76
|
- - "~>"
|
76
77
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
+
version: 3.4.0
|
78
79
|
type: :development
|
79
80
|
prerelease: false
|
80
81
|
version_requirements: !ruby/object:Gem::Requirement
|
81
82
|
requirements:
|
82
83
|
- - "~>"
|
83
84
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
+
version: 3.4.0
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rspec-its
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.2.0
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.2.0
|
85
100
|
- !ruby/object:Gem::Dependency
|
86
101
|
name: webmock
|
87
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +144,7 @@ email:
|
|
129
144
|
- bforma@zilverline.com
|
130
145
|
- suweller@zilverline.com
|
131
146
|
- lvonk@zilverline.com
|
147
|
+
- svdiepen@zilverline.com
|
132
148
|
executables: []
|
133
149
|
extensions: []
|
134
150
|
extra_rdoc_files: []
|
@@ -142,15 +158,15 @@ files:
|
|
142
158
|
- README.md
|
143
159
|
- Rakefile
|
144
160
|
- jortt.gemspec
|
145
|
-
- lib/
|
146
|
-
- lib/
|
147
|
-
- lib/
|
148
|
-
- lib/
|
149
|
-
- spec/freemle/client/resource_spec.rb
|
150
|
-
- spec/freemle/client_spec.rb
|
161
|
+
- lib/jortt.rb
|
162
|
+
- lib/jortt/client.rb
|
163
|
+
- lib/jortt/client/resource.rb
|
164
|
+
- lib/jortt/client/version.rb
|
151
165
|
- spec/freemle_spec.rb
|
166
|
+
- spec/jortt/client/resource_spec.rb
|
167
|
+
- spec/jortt/client_spec.rb
|
152
168
|
- spec/spec_helper.rb
|
153
|
-
homepage: https://
|
169
|
+
homepage: https://app.jortt.nl/api-documentatie
|
154
170
|
licenses:
|
155
171
|
- MIT
|
156
172
|
metadata: {}
|
@@ -170,12 +186,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
186
|
version: '0'
|
171
187
|
requirements: []
|
172
188
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.5.1
|
174
190
|
signing_key:
|
175
191
|
specification_version: 4
|
176
192
|
summary: jortt.nl REST API client
|
177
193
|
test_files:
|
178
|
-
- spec/freemle/client/resource_spec.rb
|
179
|
-
- spec/freemle/client_spec.rb
|
180
194
|
- spec/freemle_spec.rb
|
195
|
+
- spec/jortt/client/resource_spec.rb
|
196
|
+
- spec/jortt/client_spec.rb
|
181
197
|
- spec/spec_helper.rb
|
data/lib/freemle.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'freemle/client'
|
3
|
-
require 'freemle/client/version'
|
4
|
-
|
5
|
-
##
|
6
|
-
# This module contains everything needed to setup a connection to the Freemle
|
7
|
-
# API. It's only method returns a configured Freemle::Client.
|
8
|
-
module Freemle
|
9
|
-
|
10
|
-
# Convenient way to initialize a freemle client.
|
11
|
-
#
|
12
|
-
# @see {Freemle::Client.initialize}
|
13
|
-
#
|
14
|
-
# @return [ Freemle::Client ] a new freemle client instance
|
15
|
-
#
|
16
|
-
# @since 1.0.1
|
17
|
-
def client(*args)
|
18
|
-
Freemle::Client.new(*args)
|
19
|
-
end
|
20
|
-
module_function :client
|
21
|
-
|
22
|
-
end
|