image_monger_client 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -2
- data/lib/image_monger_client/pdf_service.rb +4 -4
- data/lib/image_monger_client/version.rb +1 -1
- data/spec/lib/pdf_service_spec.rb +4 -4
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ImageMongerClient
|
2
2
|
|
3
|
-
|
3
|
+
Client for ImageMonger
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,24 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
### Class Methods:
|
22
|
+
#### pdf_pages_as_image_urls(pdf_url_string)
|
23
|
+
* Returns an array of urls/strings. Each url links to an image representing a page from the pdf.
|
24
|
+
|
25
|
+
## Example
|
26
|
+
|
27
|
+
####require 'image_monger_client'
|
28
|
+
|
29
|
+
####ImageMongerClient.pdf_pages_as_image_urls('http://www.a.com/tst.pdf')
|
30
|
+
|
31
|
+
####returns
|
32
|
+
[
|
33
|
+
"http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.a.com%2Ftst.pdf/1",
|
34
|
+
"http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.a.com%2Ftst.pdf/2",
|
35
|
+
"http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.a.com%2Ftst.pdf/3",
|
36
|
+
"http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.a.com%2Ftst.pdf/4"
|
37
|
+
]
|
38
|
+
|
22
39
|
|
23
40
|
## Contributing
|
24
41
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'open-uri'
|
2
2
|
require 'json'
|
3
3
|
require 'cgi'
|
4
4
|
|
@@ -12,17 +12,17 @@ module ImageMongerClient
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def pages_as_image_urls
|
15
|
-
JSON.parse(converter_response.
|
15
|
+
JSON.parse(converter_response.read)
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def converter_response
|
21
|
-
|
21
|
+
open(converter_url)
|
22
22
|
end
|
23
23
|
|
24
24
|
def converter_url
|
25
|
-
"#{"
|
25
|
+
"#{"https://image-monger.services.lokalebasen.dk/pdf"}/#{encoded_pdf_url}/menu"
|
26
26
|
end
|
27
27
|
|
28
28
|
def encoded_pdf_url
|
@@ -7,17 +7,17 @@ describe ImageMongerClient::PdfService do
|
|
7
7
|
describe "#split" do
|
8
8
|
|
9
9
|
let(:url_1) {
|
10
|
-
"http://
|
10
|
+
"http://image-monger.services.lokalebasen.dk/pdf/http%3A%2F%2Fwww.page.pdf/1"
|
11
11
|
}
|
12
12
|
let(:url_2) {
|
13
|
-
"http://
|
13
|
+
"http://image-monger.services.lokalebasen.dk/pdf/http%3A%2F%2Fwww.page.pdf/2"
|
14
14
|
}
|
15
15
|
let(:url_list_string) { "[\"#{url_1}\", \"#{url_2}\"]" }
|
16
16
|
let(:url_list) { [url_1, url_2] }
|
17
|
-
let(:converter_response) { double('converter_response',
|
17
|
+
let(:converter_response) { double('converter_response', read: url_list_string) }
|
18
18
|
|
19
19
|
before(:each) do
|
20
|
-
|
20
|
+
pdf_service.stub(:open) {converter_response}
|
21
21
|
CGI.stub(:escape) {'encoded_url'}
|
22
22
|
end
|
23
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_monger_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.23.2
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
104
|
summary: Converts pdf to images
|