cloudxls 0.1.3 → 0.2.0
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.
- data/lib/cloudxls/version.rb +1 -1
- data/lib/cloudxls.rb +9 -10
- metadata +2 -2
data/lib/cloudxls/version.rb
CHANGED
data/lib/cloudxls.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'cloudxls/version'
|
|
|
9
9
|
|
|
10
10
|
module CloudXLS
|
|
11
11
|
@https = true
|
|
12
|
-
@api_base = 'cloudxls.com'
|
|
12
|
+
@api_base = 'cloudxls.com'.freeze
|
|
13
13
|
@api_key = ENV["CLOUDXLS_API_KEY"]
|
|
14
14
|
@ssl_bundle_path = File.dirname(__FILE__) + '/data/ca-certificates.crt'
|
|
15
15
|
@verify_ssl_certs = true
|
|
@@ -23,7 +23,7 @@ module CloudXLS
|
|
|
23
23
|
"http#{@https ? 's' : ''}://#{@api_key}:@#{@api_base}/api/v1/#{path}"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class Csv2ExcelResponse
|
|
27
27
|
attr_reader :url, :uuid, :response
|
|
28
28
|
|
|
29
29
|
def initialize(response)
|
|
@@ -34,30 +34,29 @@ module CloudXLS
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# CloudXLS.
|
|
38
|
-
# CloudXLS.
|
|
39
|
-
# CloudXLS.
|
|
40
|
-
# CloudXLS.
|
|
37
|
+
# CloudXLS.csv2excel :data => File.new('/path/to/data.csv', 'r')
|
|
38
|
+
# CloudXLS.csv2excel :data => File.new("foo,bar\nlorem,ipsum")
|
|
39
|
+
# CloudXLS.csv2excel :data_url => "https://example.com/data.csv"
|
|
40
|
+
# CloudXLS.csv2excel :data_url => "https://username:password@example.com/data.csv"
|
|
41
41
|
#
|
|
42
|
-
def self.
|
|
42
|
+
def self.csv2excel(params = {})
|
|
43
43
|
check_api_key!
|
|
44
44
|
|
|
45
45
|
headers = {}
|
|
46
46
|
|
|
47
47
|
response = execute_request do
|
|
48
|
-
RestClient.post(api_url("
|
|
48
|
+
RestClient.post(api_url("csv2excel"), params, headers)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
if params[:async].to_s == 'false'
|
|
52
52
|
response
|
|
53
53
|
else
|
|
54
|
-
|
|
54
|
+
Csv2ExcelResponse.new(response)
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def validate_params(params)
|
|
59
59
|
# complain if excel_format together with template
|
|
60
|
-
#
|
|
61
60
|
end
|
|
62
61
|
|
|
63
62
|
def self.execute_request
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudxls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|