plataforma_social 0.0.12 → 0.0.13
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.
|
@@ -14,8 +14,8 @@ module PlataformaSocial
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def self.request url, params = {}, method = "get"
|
|
17
|
-
secret = PlataformaSocial.secret
|
|
18
|
-
platform_api_key = PlataformaSocial.api_key
|
|
17
|
+
secret = params[:secret].present? ? params[:secret] : PlataformaSocial.secret
|
|
18
|
+
platform_api_key = params[:platform_api_key].present? ? params[:platform_api_key] : PlataformaSocial.api_key
|
|
19
19
|
secret_key = OpenSSL::PKey::RSA.new(File.read("#{Rails.root}/plataforma_social/keys/public.pem")).public_encrypt secret
|
|
20
20
|
params_name = method == 'get' ? :query : :body
|
|
21
21
|
params = { :network_name => "fb", :platform_api_key => platform_api_key, :signature => secret_key }.merge(params)
|
|
@@ -28,8 +28,18 @@ module PlataformaSocial
|
|
|
28
28
|
|
|
29
29
|
return nil if response.nil?
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
if response.parsed_response["data"]
|
|
32
|
+
response = response.parsed_response["data"]
|
|
33
|
+
|
|
34
|
+
begin
|
|
35
|
+
response = JSON.parse(response) if response.present? && response.is_a?(String)
|
|
36
|
+
rescue JSON::ParserError => e
|
|
37
|
+
response = response
|
|
38
|
+
end
|
|
39
|
+
elsif response.parsed_response["error"]
|
|
40
|
+
response = { "error" => response.parsed_response["error"] }
|
|
41
|
+
end
|
|
42
|
+
|
|
33
43
|
return response
|
|
34
44
|
end
|
|
35
45
|
end
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plataforma_social
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.13
|
|
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-06-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capistrano
|
|
@@ -97,6 +97,7 @@ files:
|
|
|
97
97
|
- lib/plataforma_social/request.rb
|
|
98
98
|
- lib/plataforma_social/version.rb
|
|
99
99
|
- plataforma_social.gemspec
|
|
100
|
+
- spec/dummy/log/development.log
|
|
100
101
|
homepage: http://www.dito.com.br/
|
|
101
102
|
licenses: []
|
|
102
103
|
post_install_message:
|
|
@@ -121,4 +122,6 @@ rubygems_version: 1.8.24
|
|
|
121
122
|
signing_key:
|
|
122
123
|
specification_version: 3
|
|
123
124
|
summary: Plataforma Social's integration gem
|
|
124
|
-
test_files:
|
|
125
|
+
test_files:
|
|
126
|
+
- spec/dummy/log/development.log
|
|
127
|
+
has_rdoc:
|