noko 1.4.0 → 1.5.0

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: afa40cf652f7da2b1c9feb0424800d941d997991c6c4b910c46975c5c22c5fae
4
- data.tar.gz: 56adb6ca37608d673058f13b9349d200ea376d217ea2b15ad4170baf124a2404
3
+ metadata.gz: f94cee93501cafa4e6da7bd8ef0999756bddc5522c75c80e14011ec51148c549
4
+ data.tar.gz: a01355b30b080a1a426d4ebfbeafe52e589dee5a3abb25549c45908327443e4b
5
5
  SHA512:
6
- metadata.gz: 16d9ec8b0b3ae50cc931e2326691dd4ac8c3a3865c46ef996f61ecb915db88038209daf8f17da9e28d61912ff8f7abbed22c9520fb1001347f4c709372a20a77
7
- data.tar.gz: 022b303e0a7b4f61410b7a4a9c2ef467e9e8173b971140d3bb8df764c31f88e60e5fe68a45b2f50e3a66a8d9c36e95db6a1de67775d8fb659b015b380cd61560
6
+ metadata.gz: 28a0a6f65984f9ed798c53ca41c0c284241cac772f8f79890fe3bb7460f7b88dc44ec1f286b73eb3cd95c6a25eb647fee268adccc8e783d197f1e7edb53d6faa
7
+ data.tar.gz: e987e8941de9b126f5a097fe4799f896c291182fa086e923195d3af0a0d13610ad6c2989a6fbacdbfa19532f6fbbffbe975e0efe0ad921cb91c1ea79b37317c2
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Noko
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'noko'
3
- s.version = '1.4.0'
3
+ s.version = '1.5.0'
4
4
  s.license = 'MIT'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Tim Craft']
@@ -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
@@ -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: /\A{.+}\z/}
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.0
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-01 00:00:00.000000000 Z
11
+ date: 2019-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake