noko 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/noko/client/entries.rb +24 -0
- data/lib/noko/version.rb +1 -1
- data/noko.gemspec +1 -1
- data/test/noko/client/entries_test.rb +46 -0
- data/test/noko/client_test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f94cee93501cafa4e6da7bd8ef0999756bddc5522c75c80e14011ec51148c549
|
4
|
+
data.tar.gz: a01355b30b080a1a426d4ebfbeafe52e589dee5a3abb25549c45908327443e4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a0a6f65984f9ed798c53ca41c0c284241cac772f8f79890fe3bb7460f7b88dc44ec1f286b73eb3cd95c6a25eb647fee268adccc8e783d197f1e7edb53d6faa
|
7
|
+
data.tar.gz: e987e8941de9b126f5a097fe4799f896c291182fa086e923195d3af0a0d13610ad6c2989a6fbacdbfa19532f6fbbffbe975e0efe0ad921cb91c1ea79b37317c2
|
data/lib/noko/client/entries.rb
CHANGED
@@ -19,5 +19,29 @@ module Noko
|
|
19
19
|
def delete_entry(id)
|
20
20
|
delete("/v2/entries/#{id}")
|
21
21
|
end
|
22
|
+
|
23
|
+
def mark_entry_invoiced(id, params)
|
24
|
+
put("/v2/entries/#{id}/marked_as_invoiced", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
def mark_entries_invoiced(params)
|
28
|
+
put('/v2/entries/marked_as_invoiced', params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def mark_entry_approved(id, params = nil)
|
32
|
+
put("/v2/entries/#{id}/approved", params)
|
33
|
+
end
|
34
|
+
|
35
|
+
def mark_entries_approved(params)
|
36
|
+
put('/v2/entries/approved', params)
|
37
|
+
end
|
38
|
+
|
39
|
+
def mark_entry_unapproved(id)
|
40
|
+
put("/v2/entries/#{id}/unapproved")
|
41
|
+
end
|
42
|
+
|
43
|
+
def mark_entries_unapproved(params)
|
44
|
+
put('/v2/entries/unapproved', params)
|
45
|
+
end
|
22
46
|
end
|
23
47
|
end
|
data/lib/noko/version.rb
CHANGED
data/noko.gemspec
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require_relative '../client_test'
|
2
2
|
|
3
3
|
class ClientEntriesTest < ClientTest
|
4
|
+
def time
|
5
|
+
Time.now.utc
|
6
|
+
end
|
7
|
+
|
8
|
+
def date
|
9
|
+
Date.parse('2019-03-04')
|
10
|
+
end
|
11
|
+
|
4
12
|
def test_get_entries
|
5
13
|
expect_request(:get, "#{base_url}/entries").with(auth_header).to_return(json_array_response)
|
6
14
|
|
@@ -42,4 +50,42 @@ class ClientEntriesTest < ClientTest
|
|
42
50
|
|
43
51
|
assert_equal :no_content, client.delete_entry(id)
|
44
52
|
end
|
53
|
+
|
54
|
+
def test_mark_entry_invoiced
|
55
|
+
expect_request(:put, "#{base_url}/entries/#{id}/marked_as_invoiced").with(json_request).to_return(status: 204)
|
56
|
+
|
57
|
+
assert_equal :no_content, client.mark_entry_invoiced(id, date: date)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_mark_entries_invoiced
|
61
|
+
expect_request(:put, "#{base_url}/entries/marked_as_invoiced").with(json_request).to_return(status: 204)
|
62
|
+
|
63
|
+
assert_equal :no_content, client.mark_entries_invoiced(entry_ids: ids, date: date)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_mark_entry_approved
|
67
|
+
body = /\A{"approved_at":"\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2}Z"}\z/
|
68
|
+
|
69
|
+
expect_request(:put, "#{base_url}/entries/#{id}/approved").with(json_request(body)).to_return(status: 204)
|
70
|
+
|
71
|
+
assert_equal :no_content, client.mark_entry_approved(id, approved_at: time.iso8601)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_mark_entries_approved
|
75
|
+
expect_request(:put, "#{base_url}/entries/approved").with(json_request).to_return(status: 204)
|
76
|
+
|
77
|
+
assert_equal :no_content, client.mark_entries_approved(entry_ids: ids, approved_at: time)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_mark_entry_unapproved
|
81
|
+
expect_request(:put, "#{base_url}/entries/#{id}/unapproved").with(headers: {'X-NokoToken' => token}).to_return(status: 204)
|
82
|
+
|
83
|
+
assert_equal :no_content, client.mark_entry_unapproved(id)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_mark_entries_unapproved
|
87
|
+
expect_request(:put, "#{base_url}/entries/unapproved").with(json_request).to_return(status: 204)
|
88
|
+
|
89
|
+
assert_equal :no_content, client.mark_entries_unapproved(entry_ids: ids)
|
90
|
+
end
|
45
91
|
end
|
data/test/noko/client_test.rb
CHANGED
@@ -23,8 +23,8 @@ class ClientTest < Minitest::Test
|
|
23
23
|
{headers: {'X-NokoToken' => token}}
|
24
24
|
end
|
25
25
|
|
26
|
-
def json_request
|
27
|
-
{headers: {'X-NokoToken' => token, 'Content-Type' => 'application/json'}, body:
|
26
|
+
def json_request(body=/\A{.+}\z/)
|
27
|
+
{headers: {'X-NokoToken' => token, 'Content-Type' => 'application/json'}, body: body}
|
28
28
|
end
|
29
29
|
|
30
30
|
def json_response_headers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|