cloudconvert-ruby 0.1.1 → 0.1.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 +4 -4
- data/README.md +9 -7
- data/cloudconvert-ruby.gemspec +1 -1
- data/lib/cloud_convert/client.rb +1 -1
- data/lib/cloud_convert/process.rb +4 -0
- data/lib/cloud_convert/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 537e97a5718699c8e05a7902d267e7ff1526933d
|
|
4
|
+
data.tar.gz: 315d34446c627d2a6be81dd71d5aa2a6bc34192b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7221f80081b884a347e2d89b999e71acf6e6b20c545f6e0849713122467a2d9591a51cff92a021f71287e1ac5d53f19054b9962f5b7b74dc41a2e3cf2f88bc54
|
|
7
|
+
data.tar.gz: cedd30b8eb75769f804c343c9c3595434b59c3fce17bc3588c2c897164f8c0defab5b91785c8131ab60c2da06615772b1567e0ddf34a47651360297ceaee8a4e
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CloudConvert-Ruby
|
|
2
2
|
|
|
3
|
-
CloudConvert-Ruby is a ruby wrapper for the [Cloud Convert](https://
|
|
3
|
+
CloudConvert-Ruby is a ruby wrapper for the [Cloud Convert](https://cloudconvert.com/) api. It takes an object oriented approach to using the API, allowing you to quickly execute and access your conversions.
|
|
4
4
|
|
|
5
5
|
This gem is in its very early stage and is updated as the need arises for a new feature. I would appreciate any comments or suggestions.
|
|
6
6
|
|
|
@@ -22,13 +22,15 @@ And then execute:
|
|
|
22
22
|
@client = CloudConvert::Client.new(api_key: "Your API Key")
|
|
23
23
|
@process = @client.build_process(input_format: "jpg", output_format: "pdf")
|
|
24
24
|
@process_response = @process.create
|
|
25
|
-
@conversion_response = @process.convert(
|
|
26
|
-
input: "download",
|
|
27
|
-
outputformat: "pdf",
|
|
28
|
-
file: "link to image",
|
|
29
|
-
download: "false"
|
|
30
|
-
) if @process_response[:success]
|
|
31
25
|
if @process_response[:success]
|
|
26
|
+
@conversion_response = @process.convert(
|
|
27
|
+
input: "download",
|
|
28
|
+
outputformat: "pdf",
|
|
29
|
+
file: "link to image",
|
|
30
|
+
download: "false"
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
if @conversion_response[:success]
|
|
32
34
|
path = File.join(File.dirname(__FILE__), "output")
|
|
33
35
|
@download = @process.download(path)
|
|
34
36
|
end
|
data/cloudconvert-ruby.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
|
|
12
12
|
spec.summary = "Ruby wrapper for the Cloud Convert API"
|
|
13
13
|
spec.description = "cloudconver-ruby is a ruby wrapper for the Cloud Convert API"
|
|
14
|
-
spec.homepage = "http://github.com/edwinv710/cloudconvert-ruby"
|
|
14
|
+
spec.homepage = "http://github.com/edwinv710/cloudconvert-ruby/"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
data/lib/cloud_convert/client.rb
CHANGED
|
@@ -42,7 +42,7 @@ module CloudConvert
|
|
|
42
42
|
# Returns an array of hash with the results from the Cloud Convert list endpoint.
|
|
43
43
|
def list
|
|
44
44
|
url = "#{CloudConvert::PROTOCOL}://api.#{CloudConvert::DOMAIN}/processes"
|
|
45
|
-
response = CloudConvert::Client.send(:get, url, query: {apikey: self.api_key})
|
|
45
|
+
response = CloudConvert::Client.send(:get, url, {query: {apikey: self.api_key}})
|
|
46
46
|
return convert_response response
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -56,6 +56,7 @@ module CloudConvert
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def status
|
|
59
|
+
raise CloudConvert::InvalidStep if @step == :awaiting_creation
|
|
59
60
|
url = process_url(include_process_id: true)
|
|
60
61
|
response = send_request(http_method: :get,
|
|
61
62
|
url: url) do |response|
|
|
@@ -66,6 +67,7 @@ module CloudConvert
|
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
def download(path, file_name="")
|
|
70
|
+
raise CloudConvert::InvalidStep if @step == :awaiting_creation
|
|
69
71
|
response = HTTMultiParty.get(download_url(file_name))
|
|
70
72
|
return update_download_progress response unless response.response.code == "200"
|
|
71
73
|
file_name = response.response.header['content-disposition'][/filename=(\"?)(.+)\1/, 2] if file_name.strip.empty?
|
|
@@ -78,6 +80,7 @@ module CloudConvert
|
|
|
78
80
|
end
|
|
79
81
|
|
|
80
82
|
def delete
|
|
83
|
+
raise CloudConvert::InvalidStep if @step == :awaiting_creation
|
|
81
84
|
url = construct_url(process_response[:subdomain], "process", process_response[:id])
|
|
82
85
|
response = HTTMultiParty.delete(url)
|
|
83
86
|
@step = :deleted if response.response.code == "200"
|
|
@@ -85,6 +88,7 @@ module CloudConvert
|
|
|
85
88
|
end
|
|
86
89
|
|
|
87
90
|
def download_url(file = "")
|
|
91
|
+
raise CloudConvert::InvalidStep if @step == :awaiting_creation
|
|
88
92
|
file = "/#{file}" unless file.nil? or file.strip.empty?
|
|
89
93
|
return "https://#{@process_response[:subdomain]}.cloudconvert.com/download/#{@process_response[:id]}#{file}"
|
|
90
94
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudconvert-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edwin Velasquez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-01-
|
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -148,7 +148,7 @@ files:
|
|
|
148
148
|
- lib/cloud_convert/process.rb
|
|
149
149
|
- lib/cloud_convert/version.rb
|
|
150
150
|
- lib/cloudconvert-ruby.rb
|
|
151
|
-
homepage: http://github.com/edwinv710/cloudconvert-ruby
|
|
151
|
+
homepage: http://github.com/edwinv710/cloudconvert-ruby/
|
|
152
152
|
licenses:
|
|
153
153
|
- MIT
|
|
154
154
|
metadata:
|