plataforma_social 0.0.36 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -87,7 +87,13 @@ module PlataformaSocial
87
87
  }.merge options
88
88
 
89
89
  if settings[:signed_request]
90
- response = Request.post("#{PlataformaSocial.domains('login')}/register", settings)
90
+ header_params = {
91
+ 'User-Agent' => request.env['HTTP_USER_AGENT'],
92
+ 'Referer' => request.referer
93
+ }
94
+ response = Request.post("#{PlataformaSocial.domains('login')}/register", settings, header_params)
95
+
96
+ binding.pry
91
97
 
92
98
  data = {}
93
99
  data[:reference] = response['id'] if response.present? && response['id']
@@ -4,36 +4,36 @@ require 'httparty'
4
4
 
5
5
  module PlataformaSocial
6
6
  class Request
7
-
7
+
8
8
  def self.post url, params = {}, headers = {}
9
- request url, params, headers, 'post'
9
+ make_request url, params, headers, 'post'
10
10
  end
11
-
11
+
12
12
  def self.get url, params = {}, headers = {}
13
- request url, params, headers, 'get'
13
+ make_request url, params, headers, 'get'
14
14
  end
15
-
16
- def self.request url, params = {}, headers = {}, method = "get"
15
+
16
+ def self.make_request url, params = {}, headers = {}, method = "get"
17
17
  secret = PlataformaSocial.secret
18
18
  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)
22
-
22
+
23
23
  begin
24
24
  response = HTTParty.send(method.to_sym, url, params_name => params, :headers => headers.stringify_keys)
25
25
  rescue => e
26
26
  return e.to_s
27
27
  end
28
-
28
+
29
29
  return nil if response.nil?
30
-
30
+
31
31
  response = response.parsed_response["data"]
32
32
  response = JSON.parse(response) if response.present? && response.is_a?(String)
33
33
  return response
34
- end
34
+ end
35
35
  end
36
-
37
-
38
-
39
- end
36
+
37
+
38
+
39
+ end
@@ -1,3 +1,3 @@
1
1
  module PlataformaSocial
2
- VERSION = "0.0.36"
2
+ VERSION = "0.0.37"
3
3
  end
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.36
4
+ version: 0.0.37
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: 2014-04-25 00:00:00.000000000 Z
12
+ date: 2014-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano