doxie 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d39bd2c7b157da537b10cfb0c8ff28bdc522c82
4
- data.tar.gz: 4bfa90536b4a460b11518a43c1054d2b436f1aa5
3
+ metadata.gz: 3370afbb5baece77571aaf553c9ab158627ea651
4
+ data.tar.gz: 79755e715fff9cd0f21a0e1487cf23e1adbd0844
5
5
  SHA512:
6
- metadata.gz: 8f897990e36093e82150fe6a97186c619a73c1fbec507e191eb29be4f8e2f0a7618f291fbdd6c52d64a565baf9f778bc3e338b1b3c8326b1745fbf9e96a26f29
7
- data.tar.gz: dcef9dda48bfd608d39678075061961d2d25fdabdd30cfe084b8c618645eb36895b18807d0b95ed22d594f72c0375bbb51eba5ffef8d46a77f1b38442eb713f6
6
+ metadata.gz: 6a941b7938332624eba5ae4c7738ce6a7d432c42d23c3ff5f373b0465a0bfef65f31b9fe2a1a6834dce9b9711bea2b5d639faf178495e6a85d51baf59db8fbe3
7
+ data.tar.gz: 531724d20aa48191801ed2cf8be13b579809b905a68e7fcd628cca0570273bf7810e0aee83c409977f589ae347d8314938503c30b448431cebbd9f48e1cd63c4
data/README.md CHANGED
@@ -111,6 +111,20 @@ client.thumbnail "/DOXIE/JPEG/IMG_0001.JPG", 'test.jpg'
111
111
  => true
112
112
  ```
113
113
 
114
+ ### DELETE /scans/DOXIE/JPEG/IMG_XXXX.JPG
115
+
116
+ ```rb
117
+ client.delete_scan "/DOXIE/JPEG/IMG_0001.JPG"
118
+ => true
119
+ ```
120
+
121
+ ### POST /scans/delete.json
122
+
123
+ ```rb
124
+ client.delete_scans ["/DOXIE/JPEG/IMG_0001.JPG", "/DOXIE/JPEG/IMG_0002.JPG"]
125
+ => true
126
+ ```
127
+
114
128
  ## Contributing
115
129
 
116
130
  1. **Fork** the repo on GitHub
data/doxie.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'doxie'
4
- s.version = '0.0.9'
4
+ s.version = '0.0.10'
5
5
  s.summary = "Doxie API Wrapper for getting scans off your Doxie scanner"
6
6
  s.description = "Doxie API Wrapper for getting scans off your Doxie scanner"
7
7
  s.authors = ["Cristiano Betta"]
data/lib/doxie.rb CHANGED
@@ -49,6 +49,10 @@ module Doxie
49
49
  delete("/scans#{scan_name}")
50
50
  end
51
51
 
52
+ def delete_scans scan_names
53
+ post("/scans/delete.json", scan_names)
54
+ end
55
+
52
56
  private
53
57
 
54
58
  def get path
@@ -57,6 +61,14 @@ module Doxie
57
61
  parse(request(uri, message))
58
62
  end
59
63
 
64
+ def post path, params
65
+ uri = uri_for(path)
66
+ message = Net::HTTP::Post.new(uri.request_uri)
67
+ message.body = JSON.generate(params)
68
+ parse(request(uri, message))
69
+ end
70
+
71
+
60
72
  def delete path
61
73
  uri = uri_for(path)
62
74
  message = Net::HTTP::Delete.new(uri.request_uri)
data/spec/doxie_spec.rb CHANGED
@@ -84,7 +84,7 @@ describe 'Doxie::Client' do
84
84
  end
85
85
  end
86
86
 
87
- describe 'delete /scans/DOXIE/JPEG/IMG_0001.JPG' do
87
+ describe 'DELETE /scans/DOXIE/JPEG/IMG_0001.JPG' do
88
88
  it 'should return the result' do
89
89
  stub_request(:delete, "#{@base_url}/scans/DOXIE/JPEG/IMG_0001.JPG")
90
90
  .to_return(@json_response_body)
@@ -92,6 +92,14 @@ describe 'Doxie::Client' do
92
92
  end
93
93
  end
94
94
 
95
+ describe 'POST /scans/delete.json' do
96
+ it 'should return the result' do
97
+ stub_request(:post, "#{@base_url}/scans/delete.json")
98
+ .to_return(status: 204)
99
+ @client.delete_scans(['/DOXIE/JPEG/IMG_0001.JPG']).must_equal(true)
100
+ end
101
+ end
102
+
95
103
  it 'raises an authentication error exception if the response code is 401' do
96
104
  stub_request(:get, "#{@base_url}/hello.json")
97
105
  .to_return(status: 401)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doxie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristiano Betta