doc_raptor 0.3.4 → 0.4.0

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: 58186bb6094b8f82f50d22db0144652bc6497d15
4
- data.tar.gz: 44b495b22e81a2bdc7ae25207a1d2aae692e8690
3
+ metadata.gz: 8279d25ef018cd3b58f8c7f350f4da05ca82c473
4
+ data.tar.gz: 4507a790ea7e62c4f344006d77ec0ac2e8805b36
5
5
  SHA512:
6
- metadata.gz: f0962a54f963bfd1920a629410b562faf55758704fa32548ec7aec3fd34700c4df4367831d1f42b9c1abf49b0b51d9dbefca87f996e5df93d3589a7ab56d22cb
7
- data.tar.gz: 7857b237d2cd941c80487d4cc1188a9e6beb3f544b2d7c8931a20ec1fe39af127a96ccade6f4162ea22eb57c023358eaa8609d249279a1829cea58c42b17e50a
6
+ metadata.gz: b1b2a4186acbf8a2549349c7a1ef63ca4af0fc5555a38e72cfcf3b4d4044533dbe4e0f8222c07f6b54fd2bf18dc1d93e657eea448ae0f47d804b190119a95cfc
7
+ data.tar.gz: ded0a40ad621bfb035203c7cc9591a515ca5f74d7b09e3fb61b8c0cc3387ba7adad02a53016148c542266a87b0615aefad9818b3398f50f99117c6d3f831ae1d
@@ -1,5 +1,9 @@
1
1
  # DocRaptor Gem Changelog
2
2
 
3
+ ## 0.4.0 - 2015/06/24
4
+ * Add user agent for calls `expectedbehavior_doc_raptor_gem/<gem version> <ruby platform>/<version>`
5
+ * Update development dependencies to be more modern and not have as many warnings when generating new gems
6
+
3
7
  ## 0.3.4 - 2015/02/20
4
8
  * Remove confusing Gemfile.lock.
5
9
 
data/README.md CHANGED
@@ -9,13 +9,13 @@ The gem will look for your api key in the `ENV` variable `DOCRAPTOR_API_KEY`. I
9
9
  not there, you can set it directly by calling:
10
10
 
11
11
  ```
12
- DocRaptor.api_key "My API Key Here"
12
+ DocRaptor.api_key "YOUR_API_KEY_HERE"
13
13
  ```
14
14
 
15
15
  Once an API key is set, you can create a PDF document by calling:
16
16
 
17
17
  ```
18
- DocRaptor.create(:document_content => content)
18
+ DocRaptor.create(:document_content => content, :test => true)
19
19
  ```
20
20
 
21
21
  You might want to set other options in that hash:
@@ -87,6 +87,13 @@ DocRaptor.download(download_key)
87
87
 
88
88
  The `download` function works like `DocRaptor.create` in that you get back either an HTTParty response object or you can give it a block.
89
89
 
90
+
91
+ ## Privacy
92
+
93
+ To help us improve and support DocRaptor, this library will send DocRaptor information about the version of the gem you are using, as well as your ruby runtime. If you would like to not report that data, you can do so by calling `DocRaptor.disable_agent_tracking` when you initialize the library.
94
+
95
+ At the time of writing, an example user agent string for mri ruby would be `expectedbehavior_doc_raptor_gem/0.4.3 ruby/2.2.2`.
96
+
90
97
  ## Examples
91
98
 
92
99
  Check the examples directory for some simple examples. To make them work, you will need to have the docraptor gem installed (via bundler or gem install).
@@ -6,19 +6,20 @@ Gem::Specification.new do |gem|
6
6
  gem.name = "doc_raptor"
7
7
  gem.authors = ["Michael Kuehl", "Joel Meador", "Chris Moore"]
8
8
  gem.email = ["michael@expectedbehavior.com", "joel@expectedbehavior.com"]
9
- gem.description = %q{Provides a simple ruby wrapper around the DocRaptor API}
10
9
  gem.summary = %q{Provides a simple ruby wrapper around the DocRaptor API}
10
+ gem.description = %q{Easily create PDF and Excel files from html in your Ruby application using the DocRaptor API.}
11
11
  gem.homepage = "http://docraptor.com"
12
12
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
13
  gem.files = `git ls-files`.split("\n")
14
14
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = DocRaptor::VERSION
17
+ gem.licenses = ["MIT"]
17
18
 
18
19
  gem.add_dependency "httparty", ">=0.7.0"
19
20
 
20
- gem.add_development_dependency "minitest", "~> 2.11.3"
21
- gem.add_development_dependency "pry"
22
- gem.add_development_dependency "rake"
23
- gem.add_development_dependency "webmock", "~> 1.8.2"
21
+ gem.add_development_dependency "minitest", "~> 5.7"
22
+ gem.add_development_dependency "pry", "~> 0.10"
23
+ gem.add_development_dependency "rake", "~> 10"
24
+ gem.add_development_dependency "webmock", "~> 1.21"
24
25
  end
@@ -10,11 +10,17 @@ end
10
10
  class DocRaptor
11
11
  include HTTParty
12
12
 
13
+ default_options[:headers] = { "User-Agent" => "expectedbehavior_doc_raptor_gem/#{DocRaptor::VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION}"}
14
+
13
15
  def self.api_key(key = nil)
14
16
  default_options[:api_key] = key ? key : default_options[:api_key] || ENV["DOCRAPTOR_API_KEY"]
15
17
  default_options[:api_key] || raise(DocRaptorError::NoApiKeyProvidedError.new("No API key provided"))
16
18
  end
17
19
 
20
+ def self.disable_agent_tracking
21
+ default_options[:headers].delete("User-Agent")
22
+ end
23
+
18
24
  def self.create!(options = {})
19
25
  raise ArgumentError.new "please pass in an options hash" unless options.is_a? Hash
20
26
  self.create(options.merge({:raise_exception_on_failure => true}))
@@ -1,3 +1,3 @@
1
1
  class DocRaptor
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class ApiKeyTest < MiniTest::Unit::TestCase
3
+ class ApiKeyTest < MiniTest::Test
4
4
  describe "test API keys" do
5
5
  before do
6
6
  DocRaptor.default_options.delete :api_key
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class CreateBangTest < MiniTest::Unit::TestCase
3
+ class CreateBangTest < MiniTest::Test
4
4
  describe "calling create!" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class CreateTest < MiniTest::Unit::TestCase
3
+ class CreateTest < MiniTest::Test
4
4
  describe "calling create" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -29,6 +29,24 @@ class CreateTest < MiniTest::Unit::TestCase
29
29
  end
30
30
  end
31
31
 
32
+ describe "user agent testing" do
33
+ it "sends a user agent in the header" do
34
+ stub_request(:post, /docraptor\.com/).with(:headers => { "User-Agent" => "expectedbehavior_doc_raptor_gem/#{DocRaptor::VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION}" }).to_return(:body => "", :status => 200, :headers => nil)
35
+ DocRaptor.create(:document_content => "Hey")
36
+ end
37
+
38
+ it "doesn't send a user agent in the header if .disable_agent_tracking has been called" do
39
+ agent_headers = DocRaptor.default_options[:headers]["User-Agent"]
40
+ begin
41
+ stub_request(:post, /docraptor\.com/).with(:headers => {}).to_return(:body => "", :status => 200, :headers => nil)
42
+ DocRaptor.disable_agent_tracking
43
+ DocRaptor.create(:document_content => "Hey")
44
+ ensure
45
+ DocRaptor.default_options[:headers]["User-Agent"] = agent_headers
46
+ end
47
+ end
48
+ end
49
+
32
50
  describe "with document_content" do
33
51
  before do
34
52
  @html_content = "<html><body>Hey</body></html>"
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class DocRaptorTest < MiniTest::Unit::TestCase
3
+ class DocRaptorTest < MiniTest::Test
4
4
  describe "the public interface" do
5
5
  methods = [:api_key,
6
6
  :create,
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class DownloadBangTest < MiniTest::Unit::TestCase
3
+ class DownloadBangTest < MiniTest::Test
4
4
  describe "download!" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class DownloadTest < MiniTest::Unit::TestCase
3
+ class DownloadTest < MiniTest::Test
4
4
  describe "download" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class ListDocsBangTest < MiniTest::Unit::TestCase
4
- describe "list_docs!" do
3
+ class ListDocsBangTest < MiniTest::Test
4
+ describe "list_docs!" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
7
7
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class ListDocsTest < MiniTest::Unit::TestCase
3
+ class ListDocsTest < MiniTest::Test
4
4
  describe "list_docs" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class StatusBangTest < MiniTest::Unit::TestCase
3
+ class StatusBangTest < MiniTest::Test
4
4
  describe "status!" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
- class StatusTest < MiniTest::Unit::TestCase
3
+ class StatusTest < MiniTest::Test
4
4
  describe "status" do
5
5
  before do
6
6
  DocRaptor.api_key "something something"
@@ -8,7 +8,7 @@ require 'webmock/minitest'
8
8
  require 'pry'
9
9
  require "doc_raptor"
10
10
 
11
- class MiniTest::Unit::TestCase
11
+ class MiniTest::Test
12
12
  def stub_http_response_with(filename, method = :any, status = 200, headers = nil)
13
13
  format = filename.split('.').last.intern
14
14
  data = file_fixture(filename)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doc_raptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kuehl
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-20 00:00:00.000000000 Z
13
+ date: 2015-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -32,57 +32,58 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 2.11.3
35
+ version: '5.7'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 2.11.3
42
+ version: '5.7'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: pry
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: '0.10'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
56
+ version: '0.10'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rake
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0'
63
+ version: '10'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: '10'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: webmock
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 1.8.2
77
+ version: '1.21'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: 1.8.2
85
- description: Provides a simple ruby wrapper around the DocRaptor API
84
+ version: '1.21'
85
+ description: Easily create PDF and Excel files from html in your Ruby application
86
+ using the DocRaptor API.
86
87
  email:
87
88
  - michael@expectedbehavior.com
88
89
  - joel@expectedbehavior.com
@@ -129,7 +130,8 @@ files:
129
130
  - test/status_test.rb
130
131
  - test/test_helper.rb
131
132
  homepage: http://docraptor.com
132
- licenses: []
133
+ licenses:
134
+ - MIT
133
135
  metadata: {}
134
136
  post_install_message:
135
137
  rdoc_options: []
@@ -147,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
149
  version: '0'
148
150
  requirements: []
149
151
  rubyforge_project:
150
- rubygems_version: 2.2.2
152
+ rubygems_version: 2.4.5
151
153
  signing_key:
152
154
  specification_version: 4
153
155
  summary: Provides a simple ruby wrapper around the DocRaptor API