infogram-ruby 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/infogram-ruby.gemspec +1 -1
- data/lib/infogram-ruby.rb +2 -5
- data/spec/infogram-ruby_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e79353bb8588170e94c8015dbada3e12974537f
|
4
|
+
data.tar.gz: 3f937f8d21e60415644c38cac3a03b19e2ed79a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc5d03bf63120cb33bf358ecdc1922e40cefa276f82ff6c31dd3da5f551073a3f3ebdf0df2955a501684e99b0ec027014813e31b1e0940551751badc0929dc7
|
7
|
+
data.tar.gz: 84e3b6bd735e8b5db959fc0ba108e37c10bdaff71afd8a5b5e6f6a73fd27538de792ab8e01174912be76ef0f08762f1545d8bbeb11fa49005cdd669dfd19bf8d
|
data/infogram-ruby.gemspec
CHANGED
data/lib/infogram-ruby.rb
CHANGED
@@ -14,10 +14,7 @@ class Infogram
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def decode_params(params)
|
17
|
-
params.keys.sort.map{ |k|
|
18
|
-
value = (k.to_s == 'content') ? url_escaping(params[k].to_json) : params[k]
|
19
|
-
"#{k}=#{value}"
|
20
|
-
}.join('&')
|
17
|
+
params.keys.sort.map{ |k| "#{k}=#{url_escaping(params[k].to_s)}" }.join('&')
|
21
18
|
end
|
22
19
|
|
23
20
|
def signature(method, path, params)
|
@@ -52,8 +49,8 @@ class Infogram
|
|
52
49
|
|
53
50
|
def create_infographic(opts={})
|
54
51
|
opts[:api_key] = @api_key
|
55
|
-
opts[:api_sig] = signature('POST', 'infographics', opts)
|
56
52
|
opts[:content] = opts[:content].to_json
|
53
|
+
opts[:api_sig] = signature('POST', 'infographics', opts)
|
57
54
|
HTTParty.post("#{@api_url}/infographics", body: opts)
|
58
55
|
end
|
59
56
|
end
|
data/spec/infogram-ruby_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe 'Infogram' do
|
|
18
18
|
}
|
19
19
|
|
20
20
|
context 'Signature' do
|
21
|
-
let (:encoded_params) { 'api_key=nMECGhmHe9&content=%5B%7B%
|
21
|
+
let (:encoded_params) { 'api_key=nMECGhmHe9&content=%5B%7B%3Atype%3D%3E%22h1%22%2C%20%3Atext%3D%3E%22Hello%20infogr.am%22%7D%5D&publish=false&theme_id=45&title=Hello' }
|
22
22
|
|
23
23
|
it 'should encode params' do
|
24
24
|
params[:api_key] = api_key
|
@@ -28,7 +28,7 @@ describe 'Infogram' do
|
|
28
28
|
it 'should generate signature' do
|
29
29
|
params[:api_key] = api_key
|
30
30
|
signature = client.signature('post', 'infographics', params)
|
31
|
-
expect(signature).to eq('
|
31
|
+
expect(signature).to eq('FqGHS3wWJQQn7yxrwhLP5qCxhjQ=')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infogram-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maksim Berjoza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|