ishapi 0.1.8.58 → 0.1.8.59
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/app/controllers/ishapi/application_controller.rb +8 -2
- data/app/controllers/ishapi/galleries_controller.rb +1 -0
- data/app/controllers/ishapi/order_items_controller.rb +22 -0
- data/app/controllers/ishapi/orders_controller.rb +23 -0
- data/app/models/ishapi/ability.rb +4 -2
- data/app/views/ishapi/orders/_item.jbuilder +3 -0
- data/app/views/ishapi/orders/_show.jbuilder +9 -0
- data/app/views/ishapi/users/show.jbuilder +4 -1
- data/config/routes.rb +2 -0
- data/lib/ishapi/engine.rb +1 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c00c8cf678dcdb4701962e756db416e57b067f40
|
4
|
+
data.tar.gz: eeac4ad9a8cbab402d824083d5b1d81b31f3c97b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4954fbd7d16a1fda79184bb644370bc186452845b7661b0823da908b834bcf6dd3f3ecc9730db0039637b6dc5cd1f4068c77ce1dbf16666b77411ad66f9357
|
7
|
+
data.tar.gz: 77f5810cc116ce442cc175528e29412b25a2406a5005096513a693ff770257c51f24ca74de9b6cd212040715bf9ad6e8fbe1fc66b11b220976db6f14c7b80831
|
@@ -21,6 +21,9 @@ module Ishapi
|
|
21
21
|
@me = @graph.get_object( 'me', :fields => 'email' )
|
22
22
|
@current_user = User.find_by :email => @me['email']
|
23
23
|
@current_profile = @current_user.profile
|
24
|
+
@current_order = @current_profile.orders.where( :submitted_at => nil ).first || ::CoTailors::Order.create( :profile_id => @current_profile.id )
|
25
|
+
else
|
26
|
+
@current_user = current_user if Rails.env.test?
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
@@ -55,12 +58,15 @@ module Ishapi
|
|
55
58
|
:name => params[:name],
|
56
59
|
:signed_request => params[:signedRequest]
|
57
60
|
end
|
58
|
-
@current_user
|
59
|
-
@current_profile
|
61
|
+
@current_user = @user
|
62
|
+
@current_profile = @profile
|
63
|
+
@current_order = @current_profile.orders.where( :submitted_at => nil ).first || ::CoTailors::Order.new( :profile_id => @current_profile.id )
|
60
64
|
rescue Koala::Facebook::AuthenticationError => e
|
61
65
|
render :json => { :status => :not_ok, :errors => "Probably expired token: #{accessToken}" }
|
62
66
|
return
|
63
67
|
end
|
68
|
+
else
|
69
|
+
@current_user = current_user if Rails.env.test?
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class OrderItemsController < ApplicationController
|
5
|
+
before_action :check_profile, :only => [ :create ]
|
6
|
+
|
7
|
+
def create
|
8
|
+
# byebug
|
9
|
+
|
10
|
+
authorize! :add, CoTailors::OrderItem
|
11
|
+
@order_item = CoTailors::OrderItem.new params['order_item'].permit!
|
12
|
+
@order_item.order_id = @current_order.id
|
13
|
+
flag = @order_item.save
|
14
|
+
if flag
|
15
|
+
render :json => { :status => :ok, :message => 'Successfully put an order item' }
|
16
|
+
else
|
17
|
+
render :json => { :status => :not_ok, :error => @order_item.errors.messages }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class OrdersController < ApplicationController
|
5
|
+
before_action :check_profile, :only => [ :create ]
|
6
|
+
|
7
|
+
def create
|
8
|
+
authorize! :create, CoTailors::Order
|
9
|
+
|
10
|
+
# byebug
|
11
|
+
|
12
|
+
@order = CoTailors::Order.where( :profile_id => @current_profile.id, :submitted_at => nil ).first
|
13
|
+
@order.submitted_at = Time.now
|
14
|
+
flag = @order.save
|
15
|
+
if flag
|
16
|
+
render :json => { :status => :ok, :message => 'Successfully placed the order' }
|
17
|
+
else
|
18
|
+
render :json => { :status => :not_ok, :error => @order.errors.messages }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -18,7 +18,7 @@ class Ishapi::Ability
|
|
18
18
|
end
|
19
19
|
|
20
20
|
|
21
|
-
can [ :update ], CoTailors::Address do |address|
|
21
|
+
can [ :update ], ::CoTailors::Address do |address|
|
22
22
|
puts [ user.inspect, address.inspect ], '+++ user in cancancan'
|
23
23
|
true
|
24
24
|
end
|
@@ -31,7 +31,9 @@ class Ishapi::Ability
|
|
31
31
|
|
32
32
|
can [ :index, :show ], City
|
33
33
|
|
34
|
-
can [ :update ], CoTailors::Address
|
34
|
+
can [ :update ], ::CoTailors::Address
|
35
|
+
can [ :add ], ::CoTailors::OrderItem
|
36
|
+
can [ :create ], ::CoTailors::Order
|
35
37
|
|
36
38
|
can [ :index, :show ], Event
|
37
39
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
#
|
3
|
-
# ishapi / users /
|
3
|
+
# ishapi / users / show.jbuilder
|
4
4
|
#
|
5
5
|
|
6
6
|
json.email @current_profile.email
|
@@ -18,3 +18,6 @@ end
|
|
18
18
|
if @current_profile.addresses[0]
|
19
19
|
json.partial! 'ishapi/addresses/show', :address => @current_profile.addresses[0]
|
20
20
|
end
|
21
|
+
|
22
|
+
json.partial! 'ishapi/orders/show', :order => @current_order
|
23
|
+
|
data/config/routes.rb
CHANGED
@@ -7,6 +7,8 @@ Ishapi::Engine.routes.draw do
|
|
7
7
|
get 'cities', :to => 'cities#index'
|
8
8
|
get 'cities/view/:cityname', :to => 'cities#show'
|
9
9
|
|
10
|
+
post 'co_tailors/orders', :to => 'orders#create'
|
11
|
+
post 'co_tailors/order_items', :to => 'order_items#create'
|
10
12
|
namespace :co_tailors do
|
11
13
|
end
|
12
14
|
|
data/lib/ishapi/engine.rb
CHANGED
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.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: jbuilder
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.7.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.7.0
|
153
167
|
description: " Description of Ishapi."
|
154
168
|
email:
|
155
169
|
- piousbox@gmail.com
|
@@ -183,6 +197,8 @@ files:
|
|
183
197
|
- app/controllers/ishapi/my/reports_controller.rb~
|
184
198
|
- app/controllers/ishapi/newsitems_controller.rb
|
185
199
|
- app/controllers/ishapi/newsitems_controller.rb~
|
200
|
+
- app/controllers/ishapi/order_items_controller.rb
|
201
|
+
- app/controllers/ishapi/orders_controller.rb
|
186
202
|
- app/controllers/ishapi/payments_controller.rb
|
187
203
|
- app/controllers/ishapi/reports_controller.rb
|
188
204
|
- app/controllers/ishapi/reports_controller.rb~
|
@@ -229,6 +245,8 @@ files:
|
|
229
245
|
- app/views/ishapi/newsitems/_index.jbuilder
|
230
246
|
- app/views/ishapi/newsitems/_index.jbuilder~
|
231
247
|
- app/views/ishapi/newsitems/index.jbuilder
|
248
|
+
- app/views/ishapi/orders/_item.jbuilder
|
249
|
+
- app/views/ishapi/orders/_show.jbuilder
|
232
250
|
- app/views/ishapi/photos/_index.jbuilder
|
233
251
|
- app/views/ishapi/photos/_index.jbuilder~
|
234
252
|
- app/views/ishapi/photos/_show.jbuilder
|