docraptor 0.1.0 → 0.2.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: fad9a985e8677d1e169dfe5ff389f8a49c8d1ebd
4
- data.tar.gz: 345911f7f165e051bc60a171493524a0cdc169d0
3
+ metadata.gz: 6a54ab8664324ce2f630ba8a0838b7bd15c99c19
4
+ data.tar.gz: b24824eb919e02bad8ba05790e1c4423a1158dfb
5
5
  SHA512:
6
- metadata.gz: f43ad89a0e4bddb075348cbd73b3eefd72398c282b2640e14516e53acbb945a3bf14ba00a1e338066cbbcf6bbb8b22485ad32d9e3749bb0441911a4da196ae49
7
- data.tar.gz: e9d1311fe9e602dffbc5429dd266f916c850f9069c3272b7c462280f32363b0f901f6d27bd9a08672e156ebb33664935b2fe43fbd18280699afa0e5206a69564
6
+ metadata.gz: 08e853b7a0eb1bb0ef8d7b2e390556ff786993e09b9579a397d15a4050f3823cf19e428b657ff87066153150970cfcf28bf7f86fc268f2bc41dd1e379919edff
7
+ data.tar.gz: 116c4516a5342d4d3f3556c2d0cbf5b6e5717239bf5c5919958b81368dcbff640ad10e8408000eaf90c6c5c4f494ec6c6c1a52c1155e3bc364624265d30da949
@@ -1,3 +1,6 @@
1
+ ### 0.2.0 [January 29, 2016]
2
+ * **BREAKING CHANGE**: Rename ClientApi to DocApi
3
+
1
4
  ### 0.1.0 [January 27, 2016]
2
5
  * **BREAKING CHANGE**: create_doc and get_async_doc responses are now binary strings instead of Tempfiles
3
6
 
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # DocRaptor Ruby Native Client Library
2
2
 
3
- **WARNING: This code is not production ready, you should use [doc_raptor_gem](https://github.com/expectedbehavior/doc_raptor_gem).**
4
-
5
3
  This is a Ruby gem for using [DocRaptor API](http://docraptor.com/documentation) to convert HTML to PDF and XLSX.
6
4
 
5
+
7
6
  ## Installation
8
7
 
9
8
  Add the following to your `Gemfile`.
@@ -12,7 +11,12 @@ Add the following to your `Gemfile`.
12
11
  gem "docraptor"
13
12
  ```
14
13
 
15
- Then run `bundle install`.
14
+ Then run:
15
+
16
+ ```bash
17
+ bundle install
18
+ ```
19
+
16
20
 
17
21
  ## Usage
18
22
 
@@ -24,7 +28,7 @@ DocRaptor.configure do |dr|
24
28
  # dr.debugging = true
25
29
  end
26
30
 
27
- $docraptor = DocRaptor::ClientApi.new
31
+ $docraptor = DocRaptor::DocApi.new
28
32
 
29
33
  response = $docraptor.create_doc(
30
34
  test: true, # test documents are free but watermarked
@@ -42,12 +46,13 @@ response = $docraptor.create_doc(
42
46
 
43
47
  Docs created like this are limited to 60 seconds to render, check out the [async example](examples/async.rb) which allows 10 minutes.
44
48
 
45
-
46
49
  We have guides for doing some of the common things:
50
+
47
51
  * [Headers and Footers](https://docraptor.com/documentation/style#pdf-headers-footers) including page skipping
48
52
  * [CSS Media Selector](https://docraptor.com/documentation/api#api_basic_pdf) to make the page look exactly as it does in your browser
49
53
  * [Protected Content](https://docraptor.com/documentation/api#api_advanced_pdf) to secure your URLs so only DocRaptor can access them
50
54
 
55
+
51
56
  ## More Help
52
57
 
53
58
  DocRaptor has a lot of more [styling](https://docraptor.com/documentation/style) and [implementation options](https://docraptor.com/documentation/api).
@@ -59,18 +64,17 @@ Stuck? We're experts at using DocRaptor so please [email us](mailto:support@docr
59
64
 
60
65
  The majority of the code in this repo is generated using swagger-codegen on [docraptor.yaml](docraptor.yaml). You can modify this file and regenerate the client using `script/generate_language ruby`.
61
66
 
62
- The generated client needed a few fixes
63
- - binary string response code generated from https://github.com/swagger-api/swagger-codegen/pull/1934
64
-
65
67
 
66
68
  ## Release Process
67
69
 
68
70
  1. `script/test`
69
71
  2. Increment version in code:
70
72
  - `swagger-config.json`
71
- - `docraptor.gemspec`
73
+ - `lib/docraptor/version.rb`
72
74
  3. Update [CHANGELOG.md](CHANGELOG.md)
73
75
  4. `rake release`
76
+ 5. Update documentation on docraptor.com
77
+
74
78
 
75
79
  ## Version Policy
76
80
 
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11'
28
28
 
29
29
  s.files = `git ls-files`.split("\n").uniq.sort.select{|f| !f.empty? }
30
+ # s.test_files = `git ls-files spec`.split("\n")
30
31
  s.executables = []
31
32
  s.require_paths = ["lib"]
32
33
  end
@@ -10,7 +10,7 @@ schemes: [https]
10
10
  securityDefinitions:
11
11
  basicAuth:
12
12
  type: basic
13
- description: HTTP Basic Authentication. Works over `HTTP` and `HTTPS`
13
+ description: Use your API key as the username. Password does not need to be set.
14
14
  produces:
15
15
  - application/json
16
16
  - application/xml
@@ -22,8 +22,8 @@ paths:
22
22
  /docs:
23
23
  post:
24
24
  operationId: createDoc
25
- tags: [Client]
26
- description: |
25
+ tags: [Doc]
26
+ description: >
27
27
  Creates a document synchronously.
28
28
  security:
29
29
  - basicAuth: []
@@ -53,10 +53,11 @@ paths:
53
53
  /async_docs:
54
54
  post:
55
55
  operationId: createAsyncDoc
56
- tags: [Client]
57
- description: |
56
+ tags: [Doc]
57
+ description: >
58
58
  Creates a document asynchronously.
59
- You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
59
+ You must use a callback url or the the returned status id and the status api to find out when it completes.
60
+ Then use the download api to get the document.
60
61
  security:
61
62
  - basicAuth: []
62
63
  parameters:
@@ -85,8 +86,8 @@ paths:
85
86
  /status/{id}:
86
87
  get:
87
88
  operationId: getAsyncDocStatus
88
- tags: [Client]
89
- description: |
89
+ tags: [Doc]
90
+ description: >
90
91
  Check on the status of an asynchronously created document.
91
92
  security:
92
93
  - basicAuth: []
@@ -109,12 +110,11 @@ paths:
109
110
  500:
110
111
  description: Server Error
111
112
 
112
-
113
113
  /download/{id}:
114
114
  get:
115
115
  operationId: getAsyncDoc
116
- tags: [Client]
117
- description: |
116
+ tags: [Doc]
117
+ description: >
118
118
  Downloads a document.
119
119
  security:
120
120
  - basicAuth: []
@@ -156,12 +156,12 @@ definitions:
156
156
  - xlsx
157
157
  document_content:
158
158
  type: string
159
- description: |
159
+ description: >
160
160
  The HTML data to be transformed into a document.
161
161
  You must supply content using document_content or document_url.
162
162
  document_url:
163
163
  type: string
164
- description: |
164
+ description: >
165
165
  The URL to fetch the HTML data to be transformed into a document.
166
166
  You must supply content using document_content or document_url.
167
167
  test:
@@ -195,7 +195,7 @@ definitions:
195
195
  description: Set HTTP referrer when generating this document.
196
196
  callback_url:
197
197
  type: string
198
- description: |
198
+ description: >
199
199
  A URL that will receive a POST request after successfully completing an asynchronous document.
200
200
  The POST data will include download_url and download_id similar to status api responses.
201
201
  WARNING: this only works on asynchronous documents.
@@ -18,7 +18,7 @@ DocRaptor.configure do |dr|
18
18
  # dr.debugging = true
19
19
  end
20
20
 
21
- $docraptor = DocRaptor::ClientApi.new
21
+ $docraptor = DocRaptor::DocApi.new
22
22
 
23
23
  begin
24
24
 
@@ -19,7 +19,7 @@ DocRaptor.configure do |dr|
19
19
  # dr.debugging = true
20
20
  end
21
21
 
22
- $docraptor = DocRaptor::ClientApi.new
22
+ $docraptor = DocRaptor::DocApi.new
23
23
 
24
24
  begin
25
25
 
@@ -11,7 +11,7 @@ require 'docraptor/models/async_doc'
11
11
  require 'docraptor/models/async_doc_status'
12
12
 
13
13
  # APIs
14
- require 'docraptor/api/client_api'
14
+ require 'docraptor/api/doc_api'
15
15
 
16
16
  module DocRaptor
17
17
  class << self
@@ -1,7 +1,7 @@
1
1
  require "uri"
2
2
 
3
3
  module DocRaptor
4
- class ClientApi
4
+ class DocApi
5
5
  attr_accessor :api_client
6
6
 
7
7
  def initialize(api_client = ApiClient.default)
@@ -9,7 +9,7 @@ module DocRaptor
9
9
  end
10
10
 
11
11
  #
12
- # Creates a document asynchronously.\nYou must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
12
+ # Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
13
13
  # @param doc The document to be created.
14
14
  # @param [Hash] opts the optional parameters
15
15
  # @return [AsyncDoc]
@@ -19,13 +19,13 @@ module DocRaptor
19
19
  end
20
20
 
21
21
  #
22
- # Creates a document asynchronously.\nYou must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
22
+ # Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
23
23
  # @param doc The document to be created.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @return [Array<(AsyncDoc, Fixnum, Hash)>] AsyncDoc data, response status code and response headers
26
26
  def create_async_doc_with_http_info(doc, opts = {})
27
27
  if @api_client.config.debugging
28
- @api_client.config.logger.debug "Calling API: ClientApi#create_async_doc ..."
28
+ @api_client.config.logger.debug "Calling API: DocApi#create_async_doc ..."
29
29
  end
30
30
 
31
31
  # verify the required parameter 'doc' is set
@@ -54,7 +54,6 @@ module DocRaptor
54
54
  # http body (model)
55
55
  post_body = @api_client.object_to_http_body(doc)
56
56
 
57
-
58
57
  auth_names = ['basicAuth']
59
58
  data, status_code, headers = @api_client.call_api(:POST, path,
60
59
  :header_params => header_params,
@@ -64,7 +63,7 @@ module DocRaptor
64
63
  :auth_names => auth_names,
65
64
  :return_type => 'AsyncDoc')
66
65
  if @api_client.config.debugging
67
- @api_client.config.logger.debug "API called: ClientApi#create_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
66
+ @api_client.config.logger.debug "API called: DocApi#create_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
68
67
  end
69
68
  return data, status_code, headers
70
69
  end
@@ -86,7 +85,7 @@ module DocRaptor
86
85
  # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
87
86
  def create_doc_with_http_info(doc, opts = {})
88
87
  if @api_client.config.debugging
89
- @api_client.config.logger.debug "Calling API: ClientApi#create_doc ..."
88
+ @api_client.config.logger.debug "Calling API: DocApi#create_doc ..."
90
89
  end
91
90
 
92
91
  # verify the required parameter 'doc' is set
@@ -115,7 +114,6 @@ module DocRaptor
115
114
  # http body (model)
116
115
  post_body = @api_client.object_to_http_body(doc)
117
116
 
118
-
119
117
  auth_names = ['basicAuth']
120
118
  data, status_code, headers = @api_client.call_api(:POST, path,
121
119
  :header_params => header_params,
@@ -125,7 +123,7 @@ module DocRaptor
125
123
  :auth_names => auth_names,
126
124
  :return_type => 'String')
127
125
  if @api_client.config.debugging
128
- @api_client.config.logger.debug "API called: ClientApi#create_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
126
+ @api_client.config.logger.debug "API called: DocApi#create_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
129
127
  end
130
128
  return data, status_code, headers
131
129
  end
@@ -147,7 +145,7 @@ module DocRaptor
147
145
  # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
148
146
  def get_async_doc_with_http_info(id, opts = {})
149
147
  if @api_client.config.debugging
150
- @api_client.config.logger.debug "Calling API: ClientApi#get_async_doc ..."
148
+ @api_client.config.logger.debug "Calling API: DocApi#get_async_doc ..."
151
149
  end
152
150
 
153
151
  # verify the required parameter 'id' is set
@@ -176,7 +174,6 @@ module DocRaptor
176
174
  # http body (model)
177
175
  post_body = nil
178
176
 
179
-
180
177
  auth_names = ['basicAuth']
181
178
  data, status_code, headers = @api_client.call_api(:GET, path,
182
179
  :header_params => header_params,
@@ -186,7 +183,7 @@ module DocRaptor
186
183
  :auth_names => auth_names,
187
184
  :return_type => 'String')
188
185
  if @api_client.config.debugging
189
- @api_client.config.logger.debug "API called: ClientApi#get_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
186
+ @api_client.config.logger.debug "API called: DocApi#get_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
190
187
  end
191
188
  return data, status_code, headers
192
189
  end
@@ -208,7 +205,7 @@ module DocRaptor
208
205
  # @return [Array<(AsyncDocStatus, Fixnum, Hash)>] AsyncDocStatus data, response status code and response headers
209
206
  def get_async_doc_status_with_http_info(id, opts = {})
210
207
  if @api_client.config.debugging
211
- @api_client.config.logger.debug "Calling API: ClientApi#get_async_doc_status ..."
208
+ @api_client.config.logger.debug "Calling API: DocApi#get_async_doc_status ..."
212
209
  end
213
210
 
214
211
  # verify the required parameter 'id' is set
@@ -237,7 +234,6 @@ module DocRaptor
237
234
  # http body (model)
238
235
  post_body = nil
239
236
 
240
-
241
237
  auth_names = ['basicAuth']
242
238
  data, status_code, headers = @api_client.call_api(:GET, path,
243
239
  :header_params => header_params,
@@ -247,13 +243,9 @@ module DocRaptor
247
243
  :auth_names => auth_names,
248
244
  :return_type => 'AsyncDocStatus')
249
245
  if @api_client.config.debugging
250
- @api_client.config.logger.debug "API called: ClientApi#get_async_doc_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
246
+ @api_client.config.logger.debug "API called: DocApi#get_async_doc_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
251
247
  end
252
248
  return data, status_code, headers
253
249
  end
254
250
  end
255
251
  end
256
-
257
-
258
-
259
-
@@ -75,10 +75,11 @@ module DocRaptor
75
75
  :ssl_verifypeer => @config.verify_ssl,
76
76
  :sslcert => @config.cert_file,
77
77
  :sslkey => @config.key_file,
78
- :cainfo => @config.ssl_ca_cert,
79
78
  :verbose => @config.debugging
80
79
  }
81
80
 
81
+ req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
82
+
82
83
  if [:post, :patch, :put, :delete].include?(http_method)
83
84
  req_body = build_request_body(header_params, form_params, opts[:body])
84
85
  req_opts.update :body => req_body
@@ -8,10 +8,10 @@ module DocRaptor
8
8
  # The type of document being created.
9
9
  attr_accessor :document_type
10
10
 
11
- # The HTML data to be transformed into a document.\nYou must supply content using document_content or document_url.
11
+ # The HTML data to be transformed into a document. You must supply content using document_content or document_url.
12
12
  attr_accessor :document_content
13
13
 
14
- # The URL to fetch the HTML data to be transformed into a document.\nYou must supply content using document_content or document_url.
14
+ # The URL to fetch the HTML data to be transformed into a document. You must supply content using document_content or document_url.
15
15
  attr_accessor :document_url
16
16
 
17
17
  # Enable test mode for this document. Test documents are not charged for but include a watermark.
@@ -35,7 +35,7 @@ module DocRaptor
35
35
  # Set HTTP referrer when generating this document.
36
36
  attr_accessor :referrer
37
37
 
38
- # A URL that will receive a POST request after successfully completing an asynchronous document.\nThe POST data will include download_url and download_id similar to status api responses.\nWARNING: this only works on asynchronous documents.
38
+ # A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status api responses. WARNING: this only works on asynchronous documents.
39
39
  attr_accessor :callback_url
40
40
 
41
41
  attr_accessor :prince_options
@@ -1,3 +1,3 @@
1
1
  module DocRaptor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -8,7 +8,7 @@ fi
8
8
 
9
9
  cd swagger-codegen
10
10
 
11
- SWAGGER_CODGEN_REVISION="e50dc04418b288dff16686a57eb6d4d540c073d2" # v2.1.5+
11
+ SWAGGER_CODGEN_REVISION="f42f9acf3564264f84b970c894574da1e4c7c053" # v2.1.5+
12
12
  if [[ `cat .git/HEAD` != "$SWAGGER_CODGEN_REVISION" ]]; then
13
13
  git fetch
14
14
  git checkout $SWAGGER_CODGEN_REVISION
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "gemName": "docraptor",
3
3
  "moduleName": "DocRaptor",
4
- "gemVersion": "0.1.0"
4
+ "gemVersion": "0.2.0"
5
5
  }
@@ -6,7 +6,7 @@ DocRaptor.configure do |dr|
6
6
  # dr.debugging = true
7
7
  end
8
8
 
9
- $docraptor = DocRaptor::ClientApi.new
9
+ $docraptor = DocRaptor::DocApi.new
10
10
 
11
11
  create_response = $docraptor.create_async_doc(
12
12
  test: true,
@@ -6,7 +6,7 @@ DocRaptor.configure do |dr|
6
6
  # dr.debugging = true
7
7
  end
8
8
 
9
- $docraptor = DocRaptor::ClientApi.new
9
+ $docraptor = DocRaptor::DocApi.new
10
10
 
11
11
  create_response = $docraptor.create_async_doc(
12
12
  test: true,
@@ -6,7 +6,7 @@ DocRaptor.configure do |dr|
6
6
  # dr.debugging = true
7
7
  end
8
8
 
9
- $docraptor = DocRaptor::ClientApi.new
9
+ $docraptor = DocRaptor::DocApi.new
10
10
 
11
11
  begin
12
12
  $docraptor.create_doc(
@@ -6,7 +6,7 @@ DocRaptor.configure do |dr|
6
6
  # dr.debugging = true
7
7
  end
8
8
 
9
- $docraptor = DocRaptor::ClientApi.new
9
+ $docraptor = DocRaptor::DocApi.new
10
10
 
11
11
  $docraptor.create_doc(
12
12
  test: true,
@@ -6,7 +6,7 @@ DocRaptor.configure do |dr|
6
6
  # dr.debugging = true
7
7
  end
8
8
 
9
- $docraptor = DocRaptor::ClientApi.new
9
+ $docraptor = DocRaptor::DocApi.new
10
10
 
11
11
  $docraptor.create_doc(
12
12
  test: true,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docraptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Miller
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-27 00:00:00.000000000 Z
12
+ date: 2016-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
@@ -250,7 +250,7 @@ files:
250
250
  - examples/async.rb
251
251
  - examples/sync.rb
252
252
  - lib/docraptor.rb
253
- - lib/docraptor/api/client_api.rb
253
+ - lib/docraptor/api/doc_api.rb
254
254
  - lib/docraptor/api_client.rb
255
255
  - lib/docraptor/api_error.rb
256
256
  - lib/docraptor/configuration.rb