-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
254 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Ilovepdf | ||
module Helper | ||
extend self | ||
|
||
def underscore_str(str) | ||
str.replace(str.scan(/[A-Z][a-z]*/).join("_").downcase) | ||
end | ||
|
||
def camelize_str(str) | ||
str.split('_').map(&:capitalize).join | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Ilovepdf | ||
module Tool | ||
class Extract < ::Ilovepdf::Task | ||
API_PARAMS = [:detailed] | ||
attr_accessor *API_PARAMS | ||
|
||
def initialize(public_key, secret_key) | ||
self.tool = :extract | ||
super(public_key, secret_key) | ||
end | ||
|
||
def detailed | ||
@detailed ||= false | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Ilovepdf | ||
module Tool | ||
class ValidatePdfa < ::Ilovepdf::Task | ||
API_PARAMS = [:conformance] | ||
attr_accessor *API_PARAMS | ||
|
||
CONFORMANCE_VALUES = ['pdfa-1b', 'pdfa-1a', 'pdfa-2b', 'pdfa-2u', | ||
'pdfa-2a', 'pdfa-3b', 'pdfa-3u', 'pdfa-3a' | ||
] | ||
|
||
def initialize(public_key, secret_key) | ||
self.tool = :validatepdfa | ||
super(public_key, secret_key) | ||
end | ||
|
||
def conformance= new_val | ||
raise Errors::ArgumentEnumError.new(CONFORMANCE_VALUES) unless CONFORMANCE_VALUES.include? new_val | ||
@conformance = new_val | ||
end | ||
|
||
def conformance | ||
@conformance ||= 'pdfa-2b' | ||
end | ||
|
||
private | ||
def download_file | ||
raise ::Ilovepdf::Errors::UnsupportedFunctionalityError.new('This tool does not download files (Check in the sample files how to use it)') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Ilovepdf | ||
VERSION = "1.0.1" | ||
VERSION = "1.1.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require "bundler/setup" | ||
require 'ilovepdf' | ||
|
||
# You can call task class directly | ||
my_task = Ilovepdf::Tool::Extract.new("PUBLIC_KEY", "SECRET_KEY"); | ||
|
||
# File object keeps information about its server_filename and the properties you can set | ||
file = my_task.add_file '/path/to/file/document.pdf' | ||
|
||
# By setting this parameter to true, | ||
# we'll have detailed contents extraction into a CSV-formatted file | ||
my_task.detailed = true | ||
|
||
# and set name for output file. | ||
# the task will set the correct file extension for you. | ||
my_task.output_filename = 'csv_filename' | ||
|
||
# Process files | ||
response = my_task.execute | ||
|
||
# and finally download the file. If no path is set, it will be downloaded on your current working directory | ||
# It will download a text file with Linux line endings | ||
my_task.download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "bundler/setup" | ||
require 'ilovepdf' | ||
|
||
# You can call task class directly | ||
my_task = Ilovepdf::Tool::Extract.new("PUBLIC_KEY", "SECRET_KEY"); | ||
|
||
# File object keeps information about its server_filename and the properties you can set | ||
file = my_task.add_file '/path/to/file/document.pdf' | ||
|
||
# Process files | ||
response = my_task.execute | ||
|
||
# and finally download the file. If no path is set, it will be downloaded on your current working directory | ||
# It will download a text file with Linux line endings | ||
my_task.download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require "bundler/setup" | ||
require 'ilovepdf' | ||
|
||
# You can call task class directly | ||
my_task = Ilovepdf::Tool::Imagepdf.new("PUBLIC_KEY", "SECRET_KEY"); | ||
|
||
# File object keeps information about its server_filename and the properties you can set | ||
file = my_task.add_file '/path/to/file/photo.png' | ||
file2 = my_task.add_file '/path/to/file/image.tiff' | ||
|
||
# Merge After: Default is true. If it is false then it will download a zip file with a pdf for each image | ||
my_task.merge_after = false | ||
|
||
# and set name for output file. | ||
# the task will set the correct file extension for you. | ||
my_task.output_filename = 'pdf_filename' | ||
|
||
# and name for splitted document (inside the zip file) | ||
my_task.packaged_filename = 'zip_filename' | ||
|
||
# Process files | ||
response = my_task.execute | ||
|
||
# and finally download the file. If no path is set, it will be downloaded on your current working directory | ||
my_task.download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "bundler/setup" | ||
require 'ilovepdf' | ||
|
||
# You can call task class directly | ||
my_task = Ilovepdf::Tool::Imagepdf.new("PUBLIC_KEY", "SECRET_KEY"); | ||
|
||
# File object keeps information about its server_filename and the properties you can set | ||
file = my_task.add_file '/path/to/file/photo.png' | ||
|
||
# Process files | ||
response = my_task.execute | ||
|
||
# and finally download the file. If no path is set, it will be downloaded on your current working directory | ||
my_task.download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.