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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # ImageMongerClient
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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 'net/http'
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.body)
15
+ JSON.parse(converter_response.read)
16
16
  end
17
17
 
18
18
  private
19
19
 
20
20
  def converter_response
21
- Net::HTTP.get_response(URI(converter_url))
21
+ open(converter_url)
22
22
  end
23
23
 
24
24
  def converter_url
25
- "#{"http://imagemonger.lokalebasen.dk/pdf"}/#{encoded_pdf_url}/menu"
25
+ "#{"https://image-monger.services.lokalebasen.dk/pdf"}/#{encoded_pdf_url}/menu"
26
26
  end
27
27
 
28
28
  def encoded_pdf_url
@@ -1,3 +1,3 @@
1
1
  module ImageMongerClient
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -7,17 +7,17 @@ describe ImageMongerClient::PdfService do
7
7
  describe "#split" do
8
8
 
9
9
  let(:url_1) {
10
- "http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.page.pdf/1"
10
+ "http://image-monger.services.lokalebasen.dk/pdf/http%3A%2F%2Fwww.page.pdf/1"
11
11
  }
12
12
  let(:url_2) {
13
- "http://imagemonger.lokalebasen.dk/pdf/http%3A%2F%2Fwww.page.pdf/2"
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', body: url_list_string) }
17
+ let(:converter_response) { double('converter_response', read: url_list_string) }
18
18
 
19
19
  before(:each) do
20
- Net::HTTP.stub(:get_response) {converter_response}
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.12
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: 2013-10-21 00:00:00.000000000 Z
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.24
101
+ rubygems_version: 1.8.23.2
102
102
  signing_key:
103
103
  specification_version: 3
104
104
  summary: Converts pdf to images