plataforma_social 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require 'koala'
2
+ require 'uri'
2
3
 
3
4
  module PlataformaSocial
4
5
  module Facebook
@@ -32,16 +33,23 @@ module PlataformaSocial
32
33
  render :text => %|<script type="text/javascript">window.top.location.href="#{@oauth.url_for_oauth_code(:permissions => PlataformaSocial.configuration.facebook_scope)}";</script>| if redirect
33
34
  end
34
35
 
35
- def load_user_data
36
- facebook_data = facebook_user_data.symbolize_keys if facebook_user_data
37
- plataforma_social_data = plataforma_social_user_data.try(:symbolize_keys)
36
+ def load_user_data options = {}
37
+ settings = {
38
+ referral_code: params[:gm_referral_code],
39
+ source: params[:source],
40
+ referrer: request.referer,
41
+ signed_request: params[:signed_request]
42
+ }.merge options
43
+
44
+ facebook_data = facebook_user_data.try(:symbolize_keys)
45
+ plataforma_social_data = plataforma_social_user_data(settings).try(:symbolize_keys)
38
46
 
39
47
  @user_data = { :facebook => facebook_data, :plataforma_social => plataforma_social_data }
40
48
  end
41
49
 
42
- def plataforma_social_user_data
43
- if params[:signed_request]
44
- response = Request.post("#{PlataformaSocial.domains('login')}/register", { :signed_request => params[:signed_request], :social_ref => params[:social_ref] })
50
+ def plataforma_social_user_data settings = {}
51
+ if settings[:signed_request]
52
+ response = Request.post("#{PlataformaSocial.domains('login')}/register", settings)
45
53
 
46
54
  data = {}
47
55
  data[:reference] = response['id'] if response.present? && response['id']
@@ -62,7 +70,16 @@ module PlataformaSocial
62
70
  end
63
71
 
64
72
  def load_oauth
65
- @oauth = Koala::Facebook::OAuth.new(PlataformaSocial.facebook_app_id, PlataformaSocial.facebook_app_secret, PlataformaSocial.facebook_callback_url)
73
+ uri = URI.parse(PlataformaSocial.facebook_callback_url.to_s)
74
+
75
+ callback_url = if uri && uri.scheme.present?
76
+ uri.query = [uri.query, "gm_referral_code=#{params[:gm_referral_code]}", "source=#{params[:source]}"].compact.join('&')
77
+ uri.to_s
78
+ else
79
+ nil
80
+ end
81
+
82
+ @oauth = Koala::Facebook::OAuth.new(PlataformaSocial.facebook_app_id, PlataformaSocial.facebook_app_secret, callback_url)
66
83
  end
67
84
 
68
85
  def load_graph
@@ -1,3 +1,3 @@
1
1
  module PlataformaSocial
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,127 +1,183 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: plataforma_social
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.18
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.19
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Marcos Nogueira
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2013-08-07 00:00:00 -03:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-08-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
17
22
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
26
31
  name: rsa
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.1.4
27
38
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
31
43
  - - ~>
32
- - !ruby/object:Gem::Version
44
+ - !ruby/object:Gem::Version
33
45
  version: 0.1.4
34
- version:
35
- - !ruby/object:Gem::Dependency
46
+ - !ruby/object:Gem::Dependency
36
47
  name: koala
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.6.0
37
54
  type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
41
59
  - - ~>
42
- - !ruby/object:Gem::Version
60
+ - !ruby/object:Gem::Version
43
61
  version: 1.6.0
44
- version:
45
- - !ruby/object:Gem::Dependency
62
+ - !ruby/object:Gem::Dependency
46
63
  name: httparty
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.10.0
47
70
  type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
51
75
  - - ~>
52
- - !ruby/object:Gem::Version
76
+ - !ruby/object:Gem::Version
53
77
  version: 0.10.0
54
- version:
55
- - !ruby/object:Gem::Dependency
78
+ - !ruby/object:Gem::Dependency
56
79
  name: json
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 1.7.7
57
86
  type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
63
93
  version: 1.7.7
64
- version:
65
- - !ruby/object:Gem::Dependency
94
+ - !ruby/object:Gem::Dependency
66
95
  name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 1.1.0
67
102
  type: :development
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
73
109
  version: 1.1.0
74
- version:
75
- - !ruby/object:Gem::Dependency
110
+ - !ruby/object:Gem::Dependency
76
111
  name: rake
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.9.2.2
77
118
  type: :development
78
- version_requirement:
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
81
123
  - - ~>
82
- - !ruby/object:Gem::Version
124
+ - !ruby/object:Gem::Version
83
125
  version: 0.9.2.2
84
- version:
85
- - !ruby/object:Gem::Dependency
126
+ - !ruby/object:Gem::Dependency
86
127
  name: rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 2.8.0
87
134
  type: :development
88
- version_requirement:
89
- version_requirements: !ruby/object:Gem::Requirement
90
- requirements:
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
91
139
  - - ~>
92
- - !ruby/object:Gem::Version
140
+ - !ruby/object:Gem::Version
93
141
  version: 2.8.0
94
- version:
95
- - !ruby/object:Gem::Dependency
142
+ - !ruby/object:Gem::Dependency
96
143
  name: vcr
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 2.0.1
97
150
  type: :development
98
- version_requirement:
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
101
155
  - - ~>
102
- - !ruby/object:Gem::Version
156
+ - !ruby/object:Gem::Version
103
157
  version: 2.0.1
104
- version:
105
- - !ruby/object:Gem::Dependency
158
+ - !ruby/object:Gem::Dependency
106
159
  name: fakeweb
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 1.3.0
107
166
  type: :development
108
- version_requirement:
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
111
171
  - - ~>
112
- - !ruby/object:Gem::Version
172
+ - !ruby/object:Gem::Version
113
173
  version: 1.3.0
114
- version:
115
174
  description: Plataforma Social's integration gem
116
- email:
175
+ email:
117
176
  - marcos.nogueira@dito.com.br
118
177
  executables: []
119
-
120
178
  extensions: []
121
-
122
179
  extra_rdoc_files: []
123
-
124
- files:
180
+ files:
125
181
  - .DS_Store
126
182
  - .gitignore
127
183
  - .rspec
@@ -231,35 +287,31 @@ files:
231
287
  - spec/plataforma_social/ranking/general_spec.rb
232
288
  - spec/plataforma_social/ranking_spec.rb
233
289
  - spec/spec_helper.rb
234
- has_rdoc: true
235
290
  homepage: http://www.dito.com.br/
236
291
  licenses: []
237
-
238
292
  post_install_message:
239
293
  rdoc_options: []
240
-
241
- require_paths:
294
+ require_paths:
242
295
  - lib
243
- required_ruby_version: !ruby/object:Gem::Requirement
244
- requirements:
245
- - - ">="
246
- - !ruby/object:Gem::Version
247
- version: "0"
248
- version:
249
- required_rubygems_version: !ruby/object:Gem::Requirement
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- version: "0"
254
- version:
296
+ required_ruby_version: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
302
+ required_rubygems_version: !ruby/object:Gem::Requirement
303
+ none: false
304
+ requirements:
305
+ - - ! '>='
306
+ - !ruby/object:Gem::Version
307
+ version: '0'
255
308
  requirements: []
256
-
257
309
  rubyforge_project:
258
- rubygems_version: 1.3.5
310
+ rubygems_version: 1.8.25
259
311
  signing_key:
260
312
  specification_version: 3
261
313
  summary: Plataforma Social's integration gem
262
- test_files:
314
+ test_files:
263
315
  - spec/.DS_Store
264
316
  - spec/cassettes/PlataformaSocial_Badge/CREATE_a_new_badge/when_request_is_successful.yml
265
317
  - spec/cassettes/PlataformaSocial_Badge/GIVE_points_to_user/when_request_is_successful_and_badges_is_array.yml