select_pdf_api 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 098930437dd6e75013830c8ceb62783b408309d6
4
- data.tar.gz: 99170880bbe8759d518cebee3ded5e3dd8c80489
3
+ metadata.gz: 8ffba95606b04785eb20d3ace85f7d5065849f1c
4
+ data.tar.gz: 7ef5a6f1059f0e71b799faecda16269fe918ec5a
5
5
  SHA512:
6
- metadata.gz: 1184de9dde9c70d531d001abd0c922abe91af93bb92f578e90e8cf5d18c188d52aba7b4f038933056b4df76785f07c51bcf185f83fe32c8715880078d19b2be5
7
- data.tar.gz: db5fdabb37f34e977ecfdacc071848f6691973c20381e718d9a30ed1aa90caaf4526d37dbdebe5f55b598279d528bad215f143697833185b49506238cc92ccf4
6
+ metadata.gz: 8d6b0cb86bf2594e3e515edfa9675d85410ad65607fe8fa67be3e93f672c61b4142bbeeeaa43d1d7791a8a43f06eda96cb3e837e992a3e0a0c0aa317d8fa3c46
7
+ data.tar.gz: 4042f562814676c368beb5591f7473ed9302a836dd012d6b8bdfabcc0c603b1467d5877dc307f52c12e7423dd0c016b9b597350bdb7e7cd8c214fa0a4ed49490
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # select_pdf_api
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/select_pdf_api.svg)](http://badge.fury.io/rb/select_pdf_api) [![Build Status](https://travis-ci.org/arian-amador/select_pdf_api.svg?style=flat)](https://travis-ci.org/arian-amador/select_pdf_api) [![Inline docs ](https://inch-ci.org/github/arian-amador/select_pdf_api.svg?branch=master)](https://inch-ci.org/github/arian-amador/select_pdf_api)
4
+
3
5
  A wrapper for the [selectpdf.org](http://selectpdf.com/) public API.
4
6
 
5
7
  The [selectpdf.org](http://selectpdf.com/) online API allows you to create PDFs from web pages and raw HTML code in your applications.
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'rake/testtask'
3
3
 
4
+ task :default => 'test'
5
+
4
6
  Rake::TestTask.new do |t|
5
7
  t.pattern = "test/test_select_pdf_api/test_*.rb"
6
8
  end
@@ -1,3 +1,3 @@
1
1
  class SelectPdfApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["arian@arianamador.com"]
10
10
  spec.summary = %q{Wrapper library for the Select PDF service.}
11
11
  spec.description = %q{Wrapper library for the Select PDF service. SelectPdf offers a REST API that can be used to convert html to pdf in any language with our dedicated web service.}
12
- spec.homepage = "https://www.github.com/arian-amador/select-pdf-api"
12
+ spec.homepage = "https://www.github.com/arian-amador/select_pdf_api"
13
13
  spec.licenses = ["MIT"]
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
@@ -21,9 +21,6 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
-
25
- spec.add_development_dependency "vcr", '~> 2.9', '>= 2.9.3'
26
- spec.add_development_dependency "webmock", '~> 1.20', '>= 1.20.4'
27
24
  spec.add_development_dependency 'minitest', '~> 5.5', '>= 5.5.1'
28
25
 
29
26
  spec.add_dependency "httparty", "~> 0.13.3"
@@ -1,13 +1,3 @@
1
1
  $:.unshift File.expand_path('../../lib', __FILE__)
2
- $:.unshift File.expand_path('../../config', __FILE__)
3
2
  require 'select_pdf_api'
4
-
5
- require 'minitest/autorun'
6
- require 'webmock/minitest'
7
- require 'vcr'
8
-
9
- VCR.configure do |c|
10
- c.allow_http_connections_when_no_cassette = false
11
- c.cassette_library_dir = "test/fixtures/vcr"
12
- c.hook_into :webmock
13
- end
3
+ require 'minitest/autorun'
@@ -2,72 +2,59 @@ require './test/minitest_helper'
2
2
 
3
3
  # API test
4
4
  describe SelectPdfApi do
5
- let(:valid_url) {'http://www.google.com'}
6
- let(:invalid_url) { SelectPdfApi.new({url: 'invalid_url'}) }
5
+ let(:fixtures) {"../test/fixtures"}
6
+ let(:minimum_config) {"#{fixtures}/minimum-config.yml"}
7
+ let(:maximum_config) {"#{fixtures}/all-config.yml"}
8
+ let(:blank_config) {"#{fixtures}/blank-config.yml"}
7
9
 
8
- let(:default_config_api) { SelectPdfApi.new({url: valid_url})}
9
- let(:minimum_config_api) { SelectPdfApi.new({url: valid_url,
10
- config_file: '../test/fixtures/minimum-config.yml'})}
11
- let(:maximum_config_api) { SelectPdfApi.new({url: valid_url,
12
- config_file: '../test/fixtures/all-config.yml'})}
10
+ let(:select_pdf) {SelectPdfApi.new({url: 'http://www.google.com'})}
11
+
12
+ before do
13
+ select_pdf.config.load_config(minimum_config)
14
+ end
13
15
 
14
16
  def test_class_exists
15
- assert default_config_api
16
- default_config_api.must_be_instance_of SelectPdfApi
17
+ assert select_pdf
18
+ select_pdf.must_be_instance_of SelectPdfApi
17
19
  end
18
20
 
19
21
  def test_save_to_should_be_changable
20
- original_filename = "/tmp/test_file_1.tmp"
21
22
  modified_filename = "/tmp/test_file_9.tmp"
22
-
23
- new_select = SelectPdfApi.new({url: valid_url, save_to: original_filename})
24
- new_select.save_to.must_equal original_filename
25
- new_select.save_to = modified_filename
26
- new_select.save_to.must_equal modified_filename
23
+ select_pdf.save_to.must_equal "document.pdf"
24
+ select_pdf.save_to = modified_filename
25
+ select_pdf.save_to.must_equal modified_filename
27
26
  end
28
27
 
29
28
  def test_url_should_be_changable
30
29
  modified_url = "http://mail.yahoo.com"
31
-
32
- default_config_api.url.must_equal valid_url
33
- default_config_api.url = modified_url
34
- default_config_api.url.must_equal modified_url
30
+ select_pdf.url.must_equal 'http://www.google.com'
31
+ select_pdf.url = modified_url
32
+ select_pdf.url.must_equal modified_url
35
33
  end
36
34
 
37
35
  describe "#params" do
38
36
  def test_params_exists
39
- default_config_api.must_respond_to 'params'
37
+ select_pdf.must_respond_to 'params'
40
38
  end
41
39
 
42
40
  def test_it_should_build_params_for_all_options
43
- maximum_config_api.params.must_equal "key=valid-key-123-67ad&margin_bottom=2pt&margin_left=1.25pt&margin_right=2pt&owner_password=owner567&page_orientation=Landscape&page_size=Letter&user_password=user123&url=http://www.google.com"
41
+ select_pdf.config.load_config(maximum_config)
42
+ select_pdf.params.must_equal "key=valid-key-123-67ad&margin_bottom=2pt&margin_left=1.25pt&margin_right=2pt&owner_password=owner567&page_orientation=Landscape&page_size=Letter&user_password=user123&url=http://www.google.com"
44
43
  end
45
44
 
46
45
  def test_it_should_build_params_for_minimum_options
47
- minimum_config_api.params.must_equal "key=random-valid-api-123abc-345dbc&url=http://www.google.com"
46
+ select_pdf.config.load_config(minimum_config)
47
+ select_pdf.params.must_equal "key=random-valid-api-123abc-345dbc&url=http://www.google.com"
48
48
  end
49
49
  end
50
50
 
51
51
  describe "#download" do
52
52
  def test_download_exists
53
- default_config_api.must_respond_to 'download'
53
+ select_pdf.must_respond_to 'download'
54
54
  end
55
55
 
56
56
  def test_it_fails_without_a_url
57
57
  -> {SelectPdfApi.new.download}.must_raise SelectPdfApi::DownloadError
58
58
  end
59
-
60
- def test_it_fails_with_an_invalid_url
61
- VCR.use_cassette('download_with_invalid_url', :record => :new_episodes) do
62
- -> {invalid_url.download}.must_raise SelectPdfApi::DownloadError
63
- end
64
- end
65
-
66
- def test_it_downloads_a_pdf
67
- VCR.use_cassette('download', :record => :new_episodes) do
68
- default_config_api.download
69
- default_config_api.success?
70
- end
71
- end
72
59
  end
73
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: select_pdf_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arian Amador
@@ -38,46 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: vcr
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.9'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 2.9.3
51
- type: :development
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: '2.9'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 2.9.3
61
- - !ruby/object:Gem::Dependency
62
- name: webmock
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.20'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 1.20.4
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '1.20'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 1.20.4
81
41
  - !ruby/object:Gem::Dependency
82
42
  name: minitest
83
43
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +96,7 @@ files:
136
96
  - test/minitest_helper.rb
137
97
  - test/test_select_pdf_api/test_api.rb
138
98
  - test/test_select_pdf_api/test_yaml_file_config.rb
139
- homepage: https://www.github.com/arian-amador/select-pdf-api
99
+ homepage: https://www.github.com/arian-amador/select_pdf_api
140
100
  licenses:
141
101
  - MIT
142
102
  metadata: {}