ishapi 0.1.8.14 → 0.1.8.15
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/controllers/ishapi/application_controller.rb +2 -1
- data/app/controllers/ishapi/cities_controller.rb +0 -1
- data/app/controllers/ishapi/users_controller.rb +55 -0
- data/app/controllers/ishapi/users_controller.rb~ +43 -0
- data/app/models/ishapi/ability.rb +1 -1
- data/app/views/ishapi/cities/show.jbuilder +3 -0
- data/app/views/ishapi/features/_index.jbuilder +5 -0
- data/app/views/ishapi/galleries/_index.jbuilder +1 -0
- data/app/views/ishapi/newsitems/_index.jbuilder +1 -0
- data/app/views/ishapi/reports/_index.jbuilder +1 -0
- data/app/views/ishapi/users/_index.jbuilder +10 -0
- data/app/views/ishapi/users/_index.jbuilder~ +7 -0
- data/app/views/ishapi/users/show.jbuilder +15 -0
- data/app/views/ishapi/users/show.jbuilder~ +9 -0
- data/app/views/ishapi/venues/_index.jbuilder +1 -0
- data/app/views/ishapi/videos/_index.jbuilder +2 -1
- data/config/routes.rb +5 -0
- metadata +16 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e342680489f7e39cb92550ace7d74a3510793c
|
4
|
+
data.tar.gz: da837c0fa8c43e47819ffd789134c0a9950e76b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec8b8ed5524363e939197469c8941e3cbc60e046eb65b7d09be5d9dd654608e9b6dc62883b55d020b8ad30e39ae25caa049fd11f45fb1dcecc0b1453b7453c2
|
7
|
+
data.tar.gz: f51815fd33819d81ab67736922c76eed51838933927e441a6abeaed6c30647355f661a5a7fa34c71316bc1e4ee9ebcd337312f7cf36ebfc1739f9e6d7785aa1b
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Ishapi
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
-
protect_from_forgery
|
3
|
+
protect_from_forgery :prepend => true, :with => :exception
|
4
4
|
layout :false
|
5
5
|
before_action :set_current_ability
|
6
6
|
check_authorization
|
7
|
+
skip_before_action :verify_authenticity_token
|
7
8
|
|
8
9
|
private
|
9
10
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class UsersController < ApplicationController
|
5
|
+
|
6
|
+
def fb_sign_in
|
7
|
+
authorize! :fb_sign_in, Ishapi
|
8
|
+
|
9
|
+
params.permit!
|
10
|
+
|
11
|
+
access_token = params[:accessToken]
|
12
|
+
email = params[:email]
|
13
|
+
name = params[:name]
|
14
|
+
user = User.where( :email => email ).first
|
15
|
+
|
16
|
+
u = IshModels::UserProfile.find_or_create_by :email => email
|
17
|
+
u.fb_access_token = access_token
|
18
|
+
u.name ||= name
|
19
|
+
u.user = user
|
20
|
+
u.user ||= User.create( :email => email, :password => (0..8).map { "#{rand(100)}" }.join("#{rand(100)}") )
|
21
|
+
|
22
|
+
if u.save
|
23
|
+
render :json => { :status => :ok }
|
24
|
+
else
|
25
|
+
render :json => { :status => :not_ok, :errors => u.errors.messages }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def show
|
30
|
+
authorize! :fb_sign_in, Ishapi
|
31
|
+
|
32
|
+
@graph = Koala::Facebook::API.new( params[:accessToken] )
|
33
|
+
me = @graph.get_object( 'me', :fields => 'email' )
|
34
|
+
@user = User.find_by( :email => me['email'] )
|
35
|
+
@user_profile = IshModels::UserProfile.find_by :email => me['email']
|
36
|
+
end
|
37
|
+
|
38
|
+
def update
|
39
|
+
authorize! :fb_sign_in, Ishapi
|
40
|
+
|
41
|
+
@graph = Koala::Facebook::API.new( params[:accessToken] )
|
42
|
+
me = @graph.get_object( 'me', :fields => 'email' )
|
43
|
+
@user = User.find_by( :email => me['email'] )
|
44
|
+
@user_profile = IshModels::UserProfile.find_by :email => me['email']
|
45
|
+
|
46
|
+
flag = @user_profile.update_attributes( params[:user_profile].permit( :about, :current_city_id ) )
|
47
|
+
if flag
|
48
|
+
render :json => { :status => :ok }
|
49
|
+
else
|
50
|
+
render :json => { :status => :not_ok, :errors => @user_profile.errors.messages }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class UsersController < ApplicationController
|
5
|
+
|
6
|
+
def fb_sign_in
|
7
|
+
authorize! :fb_sign_in, Ishapi
|
8
|
+
|
9
|
+
params.permit!
|
10
|
+
|
11
|
+
access_token = params[:accessToken]
|
12
|
+
email = params[:email]
|
13
|
+
name = params[:name]
|
14
|
+
user = User.where( :email => email ).first
|
15
|
+
|
16
|
+
u = IshModels::UserProfile.find_or_create_by :email => email
|
17
|
+
u.fb_access_token = access_token
|
18
|
+
u.name ||= name
|
19
|
+
u.user = user
|
20
|
+
u.user ||= User.create( :email => email, :password => (0..8).map { "#{rand(100)}" }.join("#{rand(100)}") )
|
21
|
+
|
22
|
+
if u.save
|
23
|
+
render :json => { :status => :ok }
|
24
|
+
else
|
25
|
+
render :json => { :status => :not_ok, :errors => u.errors.messages }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def show
|
30
|
+
puts! params, 'params'
|
31
|
+
|
32
|
+
# @oauth = Koala::Facebook::OAuth.new # ( app_id, app_secret )
|
33
|
+
# @oauth.get_user_info_from_cookies(cookies)
|
34
|
+
|
35
|
+
access_token = params[:access_token]
|
36
|
+
# @graph = Koala::Facebook::Api.new( access_token )
|
37
|
+
# puts! @graph.get_object 'me'
|
38
|
+
|
39
|
+
raise 'not implemented'
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -12,9 +12,12 @@ json.cache! key do
|
|
12
12
|
json.description @city.description
|
13
13
|
json.x @city.x
|
14
14
|
json.y @city.y
|
15
|
+
|
15
16
|
json.partial! 'ishapi/newsitems/index', :newsitems => @city.newsitems
|
17
|
+
json.partial! 'ishapi/features/index', :features => @city.features
|
16
18
|
json.partial! 'ishapi/galleries/index', :galleries => @city.galleries
|
17
19
|
json.partial! 'ishapi/reports/index', :reports => @city.reports
|
20
|
+
json.partial! 'ishapi/users/index', :users => @city.current_users
|
18
21
|
json.partial! 'ishapi/venues/index', :venues => @city.venues
|
19
22
|
json.partial! 'ishapi/videos/index', :videos => @city.videos
|
20
23
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# ishapi / users / _show.jbuilder
|
4
|
+
#
|
5
|
+
|
6
|
+
json.email @user_profile.email
|
7
|
+
json.about @user_profile.about
|
8
|
+
|
9
|
+
if @user_profile.current_city
|
10
|
+
json.current_city_id @user_profile.current_city_id.to_s
|
11
|
+
json.current_city do
|
12
|
+
json.id @user_profile.current_city_id.to_s
|
13
|
+
json.name @user_profile.current_city.name
|
14
|
+
end
|
15
|
+
end
|
data/config/routes.rb
CHANGED
@@ -12,6 +12,11 @@ Ishapi::Engine.routes.draw do
|
|
12
12
|
|
13
13
|
get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
|
14
14
|
|
15
|
+
post 'users/fb_sign_in', :to => 'users#fb_sign_in'
|
16
|
+
post 'users/profile', :to => 'users#show'
|
17
|
+
post 'users/profile/update', :to => 'users#update'
|
18
|
+
get 'users/profile', :to => 'users#show' # @TODO: only for testing! accessToken must be hidden
|
19
|
+
|
15
20
|
get 'venues/view/:venuename', :to => 'venues#show'
|
16
21
|
|
17
22
|
end
|
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.
|
4
|
+
version: 0.1.8.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -81,41 +81,27 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: koala
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec-rails
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
87
|
+
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :
|
89
|
+
version: '3.0'
|
90
|
+
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
96
|
+
version: '3.0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: fb_graph
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
|
-
type: :
|
104
|
+
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
@@ -150,6 +136,8 @@ files:
|
|
150
136
|
- app/controllers/ishapi/reports_controller.rb~
|
151
137
|
- app/controllers/ishapi/sites_controller.rb
|
152
138
|
- app/controllers/ishapi/sites_controller.rb~
|
139
|
+
- app/controllers/ishapi/users_controller.rb
|
140
|
+
- app/controllers/ishapi/users_controller.rb~
|
153
141
|
- app/controllers/ishapi/venues_controller.rb
|
154
142
|
- app/controllers/ishapi/venues_controller.rb~
|
155
143
|
- app/helpers/ishapi/application_helper.rb
|
@@ -189,6 +177,10 @@ files:
|
|
189
177
|
- app/views/ishapi/reports/show.jbuilder~
|
190
178
|
- app/views/ishapi/sites/show.jbuilder
|
191
179
|
- app/views/ishapi/sites/show.jbuilder~
|
180
|
+
- app/views/ishapi/users/_index.jbuilder
|
181
|
+
- app/views/ishapi/users/_index.jbuilder~
|
182
|
+
- app/views/ishapi/users/show.jbuilder
|
183
|
+
- app/views/ishapi/users/show.jbuilder~
|
192
184
|
- app/views/ishapi/venues/_index.haml~
|
193
185
|
- app/views/ishapi/venues/_index.jbuilder
|
194
186
|
- app/views/ishapi/venues/_index.jbuilder~
|