Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
41793608
Commit
41793608
authored
Sep 20, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix POST /orders
parent
17f8ea6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
order_spec.rb
...generators/templates/spec/requests/customer/order_spec.rb
+2
-2
buyer.rb
lib/shotengai/buyer.rb
+4
-3
No files found.
lib/generators/templates/spec/requests/customer/order_spec.rb
View file @
41793608
...
...
@@ -211,7 +211,7 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
meta:
{
type: :object
},
incr_snapshot_ids:
{
type: :array
},
},
snapshot
s
:
{
snapshot:
{
type: :object
,
properties:
{
shotengai_series_id:
{
type: :integer
},
count:
{
type: :integer
},
...
...
@@ -229,7 +229,7 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
user_remark:
'user remark ...'
,
incr_snapshot_ids:
[
@snapshot_2
.
id
],
},
snapshot
s
:
{
snapshot:
{
shotengai_series_id:
@series_1
.
id
,
count:
10
,
}
...
...
lib/shotengai/buyer.rb
View file @
41793608
...
...
@@ -38,15 +38,16 @@ module Shotengai
end
end
def buy_it_immediately snapshot
s
_param, order_params
def buy_it_immediately snapshot_param, order_params
ActiveRecord::Base.transaction do
order = self.
#{
collection_name
}
.create!(order_params)
snapshot
s_param && Shotengai::Series.find(snapshots
_param[:shotengai_series_id]).snapshots.create!(
snapshot
s
_param.merge({
snapshot
_param && Shotengai::Series.find(snapshot
_param[:shotengai_series_id]).snapshots.create!(
snapshot_param.merge({
shotengai_order: order
})
)
order
end
end
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment