ishapi 0.1.8.168 → 0.1.8.169

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0f6b63ce57718ceef61fcd162151f2ffb42d8a69103db1d1427a5c42b10905c
4
- data.tar.gz: 8221bb7ca6f4466a7c257157ef1e3a98c81510e79bcdada3d51fefc2293b3982
3
+ metadata.gz: '08c592821bf116f81b983afba7ed5986838709ff2328c22a32219efdc01c8c83'
4
+ data.tar.gz: 65b5532741934fa9abeddb5e7f226e7d38bcb2c66255812177574334275598cb
5
5
  SHA512:
6
- metadata.gz: 61c04819a602e0b7336641c1e89bb7ed635acf7681d0ea1fd063d7649fb2f7d08768be99113fd594dd132b78e48d271e492b787fa730b892c02f545f0f13e554
7
- data.tar.gz: b5e03c0aa54375793094d661899c8ab698eebc320870c47a893189fa64dcf7d02ce64ce875e7de074886d78fff2fd5a01314fdd61702d8826a1792f445ffd7ab
6
+ metadata.gz: b0fe164c5c7c3662bd4f7df897e8b5b10b69441b727392543bc41b3d2d9ab2f6da444a538787d8726160bfe3e4014229cf3d1691b8b9136928dde4a0b2d94135
7
+ data.tar.gz: c965e844069b23c23eb4837175f6bdc9dbcac69d11e0a5b3f0c6cf3be98cc6158d45aed5342a085cdb2ec70ea7c7f36fc744daa79484025642c992b8b6616e33
@@ -1,6 +1,10 @@
1
1
 
2
2
  class Ishapi::ApplicationController < ActionController::Base
3
3
 
4
+ def home
5
+ render json: { status: :ok }, status: :ok
6
+ end
7
+
4
8
  ## POST /api/users/long_term_token , a FB login flow
5
9
  def long_term_token
6
10
  accessToken = request.headers[:accessToken]
@@ -30,12 +34,25 @@ class Ishapi::ApplicationController < ActionController::Base
30
34
 
31
35
  private
32
36
 
37
+ ## This returns an empty user if not logged in!
33
38
  def check_profile
34
39
  begin
35
40
  decoded = decode(params[:jwt_token])
36
41
  @current_user = User.find decoded['user_id']
37
42
  rescue JWT::ExpiredSignature, JWT::DecodeError => e
38
- flash[:notice] = 'You are not logged in, or you have been logged out.'
43
+ # flash[:notice] = 'You are not logged in, or you have been logged out.'
44
+ # puts! 'You are not logged in, or you have been logged out.'
45
+ @current_user = User.new
46
+ end
47
+ end
48
+
49
+ ## This errors out if not logged in!
50
+ def check_profile_hard
51
+ begin
52
+ decoded = decode(params[:jwt_token])
53
+ @current_user = User.find decoded['user_id']
54
+ rescue JWT::ExpiredSignature, JWT::DecodeError => e
55
+ # flash[:notice] = 'You are not logged in, or you have been logged out.'
39
56
  # puts! 'You are not logged in, or you have been logged out.'
40
57
  end
41
58
  end
@@ -5,20 +5,13 @@ class Ishapi::MapsController < Ishapi::ApplicationController
5
5
  before_action :check_profile, only: [ :show ]
6
6
 
7
7
  def show
8
- @location = ::Gameui::Map.unscoped.find_by slug: params[:slug]
8
+ @location = ::Gameui::Map.find_by slug: params[:slug]
9
9
  @map = @location.map || @location
10
+
10
11
  authorize! :show, @map
11
12
  @newsitems = @location.newsitems
12
13
 
13
- ##
14
- ## @TODO: absolutely change this!
15
- ##
16
-
17
- @markers = @map.markers.where( is_active: true )
18
- if @current_user
19
- a = @current_user.profile.shared_markers.unscoped.where( is_active: true, map_id: @map.id ).to_a
20
- @markers = @markers + a
21
- end
14
+ @markers = @map.markers.permitted_to(current_user.profile)
22
15
 
23
16
  # case @map.ordering_type
24
17
  # when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
@@ -0,0 +1,13 @@
1
+ require_dependency "ishapi/application_controller"
2
+ module Ishapi
3
+ class StockWatchesController < ApplicationController
4
+
5
+ before_action :check_jwt
6
+
7
+ def index
8
+ authorize! :index, IronWarbler::StockWatch
9
+ @stock_watches = IronWarbler::StockWatch.active # @TODO: restrict by-profile, no?
10
+ end
11
+
12
+ end
13
+ end
@@ -5,7 +5,7 @@ module Ishapi
5
5
 
6
6
  skip_authorization_check only: %i| fb_sign_in login |
7
7
 
8
- before_action :check_profile, only: %i| account |
8
+ before_action :check_profile_hard, only: %i| account |
9
9
 
10
10
  def account
11
11
  @profile = current_user&.profile
@@ -16,10 +16,16 @@ class Ishapi::Ability
16
16
  can [ :show ], Gallery do |gallery|
17
17
  gallery.user_profile == user.profile
18
18
  end
19
+
19
20
  can [ :do_purchase ], ::Gameui
21
+ can [ :show ], ::Gameui::Map do |map|
22
+ map.creator_profile == user.profile
23
+ end
20
24
 
21
25
  can [ :create, :unlock ], ::Ish::Payment
22
26
 
27
+ can [ :index ], IronWarbler::StockWatch # @TODO: scope this to profile!
28
+
23
29
  can [ :buy_stars ], ::Ish::UserProfile
24
30
 
25
31
  end
@@ -0,0 +1,11 @@
1
+
2
+ #
3
+ # ishapi / stock_watches / index
4
+ #
5
+
6
+ json.array! @stock_watches do |w|
7
+ json.i w
8
+ json.price w[:price]
9
+ json.ticker w[:ticker]
10
+ end
11
+
data/config/routes.rb CHANGED
@@ -8,12 +8,15 @@ Ishapi::Engine.routes.draw do
8
8
  get 'cities/view/:cityname', :to => 'cities#show'
9
9
  get 'cities/features', :to => 'cities#features'
10
10
 
11
+ ## @TODO: remove all co-tailors stuff
12
+ =begin
11
13
  post 'co_tailors/orders', :to => 'orders#create'
12
14
  post 'co_tailors/order_items', :to => 'order_items#create'
13
15
  post 'co_tailors/measurements', :to => 'measurements#update'
14
16
  get 'co_tailors/products/by-kind/:kind', :to => 'products#show'
15
17
  namespace :co_tailors do
16
18
  end
19
+ =end
17
20
 
18
21
  get 'events/view/:eventname', :to => 'events#show'
19
22
 
@@ -27,8 +30,7 @@ Ishapi::Engine.routes.draw do
27
30
  get 'maps', to: 'maps#index'
28
31
  get 'maps/view/:slug', to: 'maps#show'
29
32
  get 'markers/view/:slug', to: 'maps#show_marker'
30
- get "/my/account", to: "users#account"
31
- post "/my/account", to: "users#account"
33
+ match "/my/account", to: "users#account", via: [ :get, :post ]
32
34
  namespace :my do
33
35
  get 'galleries', to: 'galleries#index'
34
36
  get 'newsitems', to: 'newsitems#index'
@@ -49,24 +51,28 @@ Ishapi::Engine.routes.draw do
49
51
  get 'reports', :to => 'reports#index'
50
52
  get 'reports/view/:slug', :to => 'reports#show'
51
53
 
52
- get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
53
- post 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
54
- get 'sites/view/:domain/newsitems/:newsitems_page', :to => 'newsitems#index', :constraints => { :domain => /[^\/]+/ }
55
- get 'sites/view/:domain/reports', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
56
- get 'sites/view/:domain/reports/page/:reports_page', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
57
- get 'sites/view/:domain/tags', :to => 'tags#index', :constraints => { :domain => /[^\/]+/ }
54
+ get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
55
+ post 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
56
+ get 'sites/view/:domain/newsitems/:newsitems_page', :to => 'newsitems#index', :constraints => { :domain => /[^\/]+/ }
57
+ get 'sites/view/:domain/reports', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
58
+ get 'sites/view/:domain/reports/page/:reports_page', :to => 'reports#index', :constraints => { :domain => /[^\/]+/ }
59
+ get 'sites/view/:domain/tags', :to => 'tags#index', :constraints => { :domain => /[^\/]+/ }
58
60
 
59
61
  post 'stars/buy', to: 'gameui#buy_stars'
60
62
 
63
+ ## 2022-02-12 moved to iron_warbler gem _vp_
64
+ # resources "stock_watches"
65
+
61
66
  get 'tags/view/:slug', :to => 'tags#show'
62
67
  get 'test', to: 'application#test'
63
68
 
64
- post 'users/fb_sign_in', :to => 'users#fb_sign_in'
65
- post 'users/profile', :to => 'users#show'
66
- post 'users/profile/update', :to => 'users#update'
67
- get 'users/profile', :to => 'users#show' # @TODO: only for testing! accessToken must be hidden
69
+ post 'users/fb_sign_in', to: 'users#fb_sign_in'
70
+ get 'users/me', to: 'users#account'
71
+ post 'users/profile', to: 'users#show'
72
+ post 'users/profile/update', to: 'users#update'
73
+ get 'users/profile', to: 'users#show' # @TODO: only for testing! accessToken must be hidden
68
74
  match 'users/long_term_token', to: 'application#long_term_token', via: [ :get, :post ]
69
- post 'users/login', to: 'users#login'
75
+ post 'users/login', to: 'users#login'
70
76
 
71
77
  get 'venues', :to => 'venues#index'
72
78
  get 'venues/view/:venuename', :to => 'venues#show'
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.168
4
+ version: 0.1.8.169
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-05 00:00:00.000000000 Z
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: 6.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.1'
26
+ version: 6.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongoid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -271,6 +271,7 @@ files:
271
271
  - app/controllers/ishapi/products_controller.rb
272
272
  - app/controllers/ishapi/reports_controller.rb
273
273
  - app/controllers/ishapi/sites_controller.rb
274
+ - app/controllers/ishapi/stock_watches_controller.rb
274
275
  - app/controllers/ishapi/tags_controller.rb
275
276
  - app/controllers/ishapi/unrestricted_controller.rb
276
277
  - app/controllers/ishapi/user_profiles_controller.rb
@@ -318,6 +319,7 @@ files:
318
319
  - app/views/ishapi/reports/index.jbuilder
319
320
  - app/views/ishapi/reports/show.jbuilder
320
321
  - app/views/ishapi/sites/show.jbuilder
322
+ - app/views/ishapi/stock_watches/index.jbuilder
321
323
  - app/views/ishapi/tags/_index.jbuilder
322
324
  - app/views/ishapi/tags/_widget.jbuilder
323
325
  - app/views/ishapi/tags/index.jbuilder