image_monger_client 0.0.7 → 0.0.8

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.
@@ -11,11 +11,12 @@ Gem::Specification.new do |s|
11
11
  s.description = %q{Ruby client for image monger}
12
12
  s.summary = %q{Converts pdf to images}
13
13
  s.homepage = ""
14
+ s.license = "MIT"
14
15
 
15
16
  s.files = `git ls-files`.split($/)
16
17
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
18
  s.test_files = s.files.grep(%r{^(test|s|features)/})
18
- s.require_paths = ["lib", "lib/image_monger_client"]
19
+ s.require_paths = ["lib"]
19
20
 
20
21
  s.add_development_dependency "rspec"
21
22
  s.add_development_dependency "bundler", "~> 1.3"
@@ -0,0 +1,30 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'cgi'
4
+
5
+ class ImageMongerClient::Client
6
+
7
+ attr_reader :pdf_url
8
+
9
+ def initialize(pdf_url)
10
+ @pdf_url = pdf_url
11
+ end
12
+
13
+ def pages_as_image_urls
14
+ JSON.parse(converter_response.body)
15
+ end
16
+
17
+ private
18
+
19
+ def converter_response
20
+ Net::HTTP.get_response(URI(converter_url))
21
+ end
22
+
23
+ def converter_url
24
+ "#{"http://imagemonger.lokalebasen.dk/pdf"}/#{encoded_pdf_url}/menu"
25
+ end
26
+
27
+ def encoded_pdf_url
28
+ CGI.escape(pdf_url)
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module ImageMongerClient
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.7
4
+ version: 0.0.8
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-18 00:00:00.000000000 Z
12
+ date: 2013-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -73,14 +73,15 @@ files:
73
73
  - Rakefile
74
74
  - image_monger_client.gemspec
75
75
  - lib/image_monger_client.rb
76
+ - lib/image_monger_client/client.rb
76
77
  - lib/image_monger_client/version.rb
77
78
  homepage: ''
78
- licenses: []
79
+ licenses:
80
+ - MIT
79
81
  post_install_message:
80
82
  rdoc_options: []
81
83
  require_paths:
82
84
  - lib
83
- - lib/image_monger_client
84
85
  required_ruby_version: !ruby/object:Gem::Requirement
85
86
  none: false
86
87
  requirements: