ishapi 0.1.8.48 → 0.1.8.49

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a1565479fe77bf8af6a6ccdabe841d09293a2ba
4
- data.tar.gz: 24e055e8d547e06810ef02cc470b772e79652c96
3
+ metadata.gz: 4150d6b2bea1d24fb8807450e8de3f9409a1e287
4
+ data.tar.gz: ed08a8de201bc63e72230b412433af5e269e4e17
5
5
  SHA512:
6
- metadata.gz: 0173d25969807aec031ef354f401630135b1f4629e40a4bc79f6afae68f8fa6a950ef67634af76ba0e04312962cc5c747f895f838249339473799b8993971b34
7
- data.tar.gz: fd336bfa29f45eb6194cc244c052c673a03c9f828cd743e93264a7b8b151770af6010651459e654adfe781bf2453108c8cb7a94243ae974cb17826143462f6f5
6
+ metadata.gz: 76548b3670c85a03d849f47da26f721c43fae1615c5772c91fa7b73e537dbc5038642be5fa8676fd0157f8a77b5fc7d3d5847e0a9ddc405302317129ad7cad5f
7
+ data.tar.gz: 11d3bd31cbcb899dd9d8c1404dee941b925e8c43bc2350beae4fad4baea3edd68e5b5e77dce031f6ae0199d66b53f6b53c7051c9c381248d9f6f5c700de74eb5
@@ -16,12 +16,14 @@ module Ishapi
16
16
  accessToken ||= params[:fb_long_access_token]
17
17
  accessToken ||= params[:accessToken] # if (params[:debug] == 'abba' && Rails.env.development?)
18
18
 
19
+ params[:domain] ||= '_default'
20
+
19
21
  if accessToken
20
22
  begin
21
23
  @graph = Koala::Facebook::API.new( accessToken )
22
24
  @me = @graph.get_object( 'me', :fields => 'email' )
23
25
  @user = User.find_or_create_by :email => @me['email']
24
- @oauth = Koala::Facebook::OAuth.new( CO_TAILORS_FB_APP_ID, CO_TAILORS_FB_APP_SECRET )
26
+ @oauth = Koala::Facebook::OAuth.new( FB[params['domain']][:app], FB[params['domain']][:secret] )
25
27
  @long_lived_token = get_long_token( accessToken )
26
28
 
27
29
  begin
@@ -47,7 +49,7 @@ module Ishapi
47
49
 
48
50
  def get_long_token accessToken
49
51
  url = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&" +
50
- "client_id=#{FB_APP_ID}&client_secret=#{FB_APP_SECRET}&fb_exchange_token=#{accessToken}"
52
+ "client_id=#{FB[params['domain']][:app]}&client_secret=#{FB[params['domain']][:secret]}&fb_exchange_token=#{accessToken}"
51
53
  result = HTTParty.get url
52
54
  token = JSON.parse result.body
53
55
  puts! token['access_token'], "long access token is"
@@ -3,7 +3,7 @@ require_dependency "ishapi/application_controller"
3
3
  module Ishapi
4
4
  class UsersController < ApplicationController
5
5
 
6
- before_action :set_profile, :only => [ :fb_sign_in ]
6
+ before_action :set_profile, :only => [ :fb_sign_in, :show ]
7
7
 
8
8
  def fb_sign_in
9
9
  authorize! :fb_sign_in, Ishapi
@@ -3,9 +3,11 @@
3
3
  # ishapi / users / _show.jbuilder
4
4
  #
5
5
 
6
- json.email @user_profile.email
7
- json.about @user_profile.about
8
- json.lang @user_profile.lang
6
+ json.email @user_profile.email
7
+ json.about @user_profile.about
8
+ json.lang @user_profile.lang
9
+ json.name @user_profile.name
10
+ json.fb_long_access_token @long_lived_token
9
11
 
10
12
  if @user_profile.current_city
11
13
  json.current_city_id @user_profile.current_city_id.to_s
@@ -1,9 +1,15 @@
1
1
 
2
- # this is for... m3?
3
-
4
- FB_APP_ID ||= '107960979836752'
5
- FB_APP_SECRET ||= '5d32afa4f281bcc28a8df092b1b081a9'
6
-
7
- # this is for... co tailors
8
- CO_TAILORS_FB_APP_ID ||= '2005729719751456'
9
- CO_TAILORS_FB_APP_SECRET ||= '7650b1e11ef22318ff5fa33e06b322ee'
2
+ FB = {
3
+ '_default' => {
4
+ :app => '',
5
+ :secret => ''
6
+ },
7
+ 'travel-guide.mobi' => {
8
+ :app => '123014244977505',
9
+ :secret => 'd74e685795a9ef2427fd586fbca99335'
10
+ },
11
+ 'colombia-tailors.com' => {
12
+ :app => '2005729719751456',
13
+ :secret => '7650b1e11ef22318ff5fa33e06b322ee'
14
+ }
15
+ }
@@ -5,6 +5,9 @@ Ishapi::Engine.routes.draw do
5
5
  get 'cities', :to => 'cities#index'
6
6
  get 'cities/view/:cityname', :to => 'cities#show'
7
7
 
8
+ namespace :co_tailors do
9
+ end
10
+
8
11
  get 'galleries', :to => 'galleries#index'
9
12
  get 'galleries/view/:galleryname', :to => 'galleries#show'
10
13
 
@@ -32,6 +35,9 @@ Ishapi::Engine.routes.draw do
32
35
 
33
36
  get 'tags/view/:tagname', :to => 'tags#show'
34
37
 
38
+ namespace :tgm do
39
+ end
40
+
35
41
  post 'users/fb_sign_in', :to => 'users#fb_sign_in'
36
42
  post 'users/profile', :to => 'users#show'
37
43
  post 'users/profile/update', :to => 'users#update'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.48
4
+ version: 0.1.8.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-21 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails