Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venshop
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huanvl
venshop
Commits
8acb3103
Commit
8acb3103
authored
Oct 30, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
limit insert only 10000 products
parent
991de60c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
venshop_app/lib/tasks/sample_data.rake
+2
-3
No files found.
venshop_app/lib/tasks/sample_data.rake
View file @
8acb3103
...
...
@@ -47,9 +47,8 @@ namespace :db do
# Product list
# http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html
list_url
=
'http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch'
category_ids
.
each
do
|
category_id
|
i
=
0
category_ids
.
each
do
|
category_id
|
(
1
..
20
).
each
do
|
offset
|
request_url
=
list_url
+
'?appid='
+
YAHOO_SHOPPING_DATA_APP_ID
+
'&category_id='
+
category_id
.
to_s
+
'&offset='
+
offset
.
to_s
+
'&hits=50'
# get the XML data as a string
...
...
@@ -59,7 +58,7 @@ namespace :db do
doc
.
elements
.
each
(
'ResultSet/Result/Hit'
)
do
|
ele
|
next
if
ele
.
elements
[
'Name'
]
==
nil
i
+=
1
break
if
i
>
2
000
break
if
i
>
10
000
name
=
ele
.
elements
[
'Name'
].
text
description
=
ele
.
elements
[
'Description'
].
text
...
...
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