summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-10-21 18:58:22 -0400
committerJules Laplace <jules@okfoc.us>2015-10-21 18:58:22 -0400
commitfffc000bd73b740318762747c07aa39adca1313a (patch)
tree641fabd47937419d023a50471514a4f47177d36b
parent2812b73724ed5fded35fa9b7fd383a6ce481e51a (diff)
stub in proxy
-rw-r--r--StoneIsland/platforms/ios/StoneIsland.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstatebin7875 -> 13540 bytes
-rw-r--r--StoneIsland/platforms/ios/StoneIsland/StoneIsland-Info.plist5
-rw-r--r--StoneIsland/platforms/ios/www/js/index.js34
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js4
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/_sdk.js9
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/account.js9
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/address.js6
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/auth.js10
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/cart.js4
-rw-r--r--StoneIsland/platforms/ios/www/js/sdk/product.js4
-rw-r--r--StoneIsland/www/js/index.js2
-rw-r--r--StoneIsland/www/js/lib/products/ProductView.js2
-rw-r--r--proxy/index.js25
-rw-r--r--proxy/package.json11
14 files changed, 89 insertions, 36 deletions
diff --git a/StoneIsland/platforms/ios/StoneIsland.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/StoneIsland.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate
index 5b45af91..12703a70 100644
--- a/StoneIsland/platforms/ios/StoneIsland.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/StoneIsland/platforms/ios/StoneIsland.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/StoneIsland/platforms/ios/StoneIsland/StoneIsland-Info.plist b/StoneIsland/platforms/ios/StoneIsland/StoneIsland-Info.plist
index 882f8e0d..884d2059 100644
--- a/StoneIsland/platforms/ios/StoneIsland/StoneIsland-Info.plist
+++ b/StoneIsland/platforms/ios/StoneIsland/StoneIsland-Info.plist
@@ -171,6 +171,11 @@
<string>{768, 1024}</string>
</dict>
</array>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ </dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
</dict>
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 31e78c92..332e780d 100644
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -1,7 +1,26 @@
var app = (function(){
var app = {}
- app.init = function(){
+ app.init = function(){
+ app.bind()
+ app.build()
+
+ sdk.init({ production: true })
+
+ if (window.cordova) {
+ document.addEventListener('deviceready', app.ready, false)
+ }
+ else {
+ app.ready()
+ }
+ }
+
+ app.bind = function(){
+ document.addEventListener('touchmove', function(e){ e.preventDefault() })
+ FastClick.attach(document.body)
+ }
+
+ app.build = function(){
app.blog = new BlogView ()
app.archive = new ArchiveView ()
app.hub = new HubView ()
@@ -21,17 +40,6 @@ var app = (function(){
app.collection = new CollectionView ()
app.selector = new Selector ()
-
- app.bind()
- }
-
- app.bind = function(){
- if (window.cordova) {
- document.addEventListener('deviceready', app.ready, false)
- }
- else {
- app.ready()
- }
}
app.ready = function(){
@@ -39,8 +47,6 @@ var app = (function(){
// cordova.plugins.Keyboard.disableScroll(true)
}
- document.addEventListener('touchmove', function(e){ e.preventDefault() })
-
app.view = null
app.router = new SiteRouter ()
app.router.route()
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
index 71d07723..987804fc 100644
--- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
@@ -26,8 +26,8 @@ var CollectionView = View.extend({
fetch: function(){
this.$loader.show()
- sdk.product.fetch_collection({
- gallery_id: 31483, // FOCUS ON CAMO
+ sdk.product.collection({
+ gallery_id: 31617,
success: this.populate.bind(this)
})
},
diff --git a/StoneIsland/platforms/ios/www/js/sdk/_sdk.js b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js
index ce68da62..a7ecf6d3 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/_sdk.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js
@@ -1,9 +1,14 @@
var sdk = (function(){
var sdk = {}
- // var endpoint = "https://secure.api.yoox.biz/"
var endpoint = "https://sandbox.api.yoox.biz/"
-
+
+ sdk.init = function(opt){
+ if (opt && opt.production) {
+ endpoint = "https://secure.api.yoox.biz/"
+ }
+ }
+
sdk.path = function(api, path){
return endpoint + api + "/STONEISLAND_US/" + path
}
diff --git a/StoneIsland/platforms/ios/www/js/sdk/account.js b/StoneIsland/platforms/ios/www/js/sdk/account.js
index a1498e76..3dfe2cfe 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/account.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/account.js
@@ -14,11 +14,10 @@ sdk.account = (function(){
},
data: opt.data,
success: function(data){
- console.log(data)
user_id = data['UserAccount']['UserId']
access_token = data['UserAccount']['AccessToken']
- auth.set_user(user_id, access_token, name)
+ auth.set_user(user_id, access_token)
opt.success(data)
},
@@ -36,9 +35,9 @@ sdk.account = (function(){
},
data: opt.data,
success: function(data){
- console.log(data)
- auth.user_id = data['UserAccount']['UserId']
- auth.access_token = data['UserAccount']['AccessToken']
+ // console.log(data)
+ // auth.user_id = data['UserFull']['UserId']
+ // auth.access_token = data['UserFull']['AccessToken']
// why bother?
// auth.set_user(user_id, access_token, name)
diff --git a/StoneIsland/platforms/ios/www/js/sdk/address.js b/StoneIsland/platforms/ios/www/js/sdk/address.js
index 16fc2dc4..144589d0 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/address.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/address.js
@@ -11,7 +11,7 @@ sdk.address = (function(){
},
data: opt.data,
success: function(data){
- console.log(data)
+ // console.log(data)
opt.success(data)
},
error: opt.error,
@@ -28,11 +28,13 @@ sdk.address = (function(){
},
data: opt.data,
success: function(data){
- console.log(data)
+ // console.log(data)
opt.success(data)
},
error: opt.error,
})
}
+
+ return address
})() \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/sdk/auth.js b/StoneIsland/platforms/ios/www/js/sdk/auth.js
index 911da902..cea0054c 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/auth.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/auth.js
@@ -10,26 +10,24 @@
var auth = (function(){
var auth = {}
- auth.appname = "{API-TEST}"
- auth.apikey = "{API-KEY}"
+ auth.appname = is_iphone ? "native-iphone-stoneisland/1.0.0" : "native-android-stoneisland/1.0.0"
+ auth.apikey = "U2FsdGVkX18fThqg9bF0/ZgE9Jg948hn8O9EXli4B2729nAESCQaexv//M5+7+za"
auth.device = "smartphone"
auth.access_token = ""
auth.user_id = -1
- auth.name = name
// ios: integrate keychain api
// android: cordova.file.externalRootDirectory api
- auth.set_user = function(user_id, access_token, name){
+ auth.set_user = function(user_id, access_token){
// persist user data
auth.user_id = user_id
auth.access_token = access_token
- auth.name = name
}
auth.get_user = function(cb){
// fetch user data
}
return auth
-})() \ No newline at end of file
+})()
diff --git a/StoneIsland/platforms/ios/www/js/sdk/cart.js b/StoneIsland/platforms/ios/www/js/sdk/cart.js
index 3c16feae..9f9d81f1 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/cart.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/cart.js
@@ -13,7 +13,7 @@ sdk.cart = (function(){
"x-yoox-appname": auth.appname,
"x-yoox-device": auth.device,
},
- data: opt.data,
+ // data: opt.data,
success: function(data){
console.log(data)
cart.id = data["CartSession"]["CartId"]
@@ -27,7 +27,7 @@ sdk.cart = (function(){
cart.set_user = function(opt){
$.ajax({
method: "PUT",
- url: sdk.path("Cart.API/1.6", "carts.json"),
+ url: sdk.path("Cart.API/1.6", "user.json"),
headers: {
"x-yoox-appname": auth.appname,
"x-yoox-cart-token": cart.token,
diff --git a/StoneIsland/platforms/ios/www/js/sdk/product.js b/StoneIsland/platforms/ios/www/js/sdk/product.js
index c904eb32..a2ba30a1 100644
--- a/StoneIsland/platforms/ios/www/js/sdk/product.js
+++ b/StoneIsland/platforms/ios/www/js/sdk/product.js
@@ -1,7 +1,7 @@
sdk.product = (function(){
var product = {}
- product.fetch_collection = function(opt){
+ product.collection = function(opt){
$.ajax({
method: "GET",
url: sdk.path("Search.API/1.2", "search.json"),
@@ -15,7 +15,7 @@ sdk.product = (function(){
product.item = function(opt){
$.ajax({
method: "GET",
- url: sdk.path("Item.API/1.0", "item/" + data.code + ".json"),
+ url: sdk.path("Item.API/1.0", "item/" + opt.code + ".json"),
success: opt.success,
error: opt.error,
})
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 82766082..332e780d 100644
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -4,6 +4,8 @@ var app = (function(){
app.init = function(){
app.bind()
app.build()
+
+ sdk.init({ production: true })
if (window.cordova) {
document.addEventListener('deviceready', app.ready, false)
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index e87fa398..76527c8b 100644
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -44,7 +44,7 @@ var ProductView = View.extend({
load: function(data){
var name_partz = data['ModelNames'].split(' ')
var num = name_partz.shift()
- var title = name_parts.join(' ')
+ var title = name_partz.join(' ')
var type = data['MicroCategory'].toUpperCase()
var price = "$" + data['DiscountedPrice'] + ".00"
var size = data['Sizes'][0]
diff --git a/proxy/index.js b/proxy/index.js
new file mode 100644
index 00000000..c2e12c60
--- /dev/null
+++ b/proxy/index.js
@@ -0,0 +1,25 @@
+var http = require('http')
+var PORT = 4567
+
+var server = http.createServer(function (req, res){
+ res.end('It Works!! Path Hit: ' + req.url)
+ console.log(req.headers)
+})
+
+server.listen(PORT, function(){
+ console.log("Proxy listening on: http://localhost:%s", PORT)
+})
+
+/*
+ headers: {
+ "x-yoox-appname": auth.appname,
+ "x-yoox-account-token": auth.access_token,
+ "x-yoox-device": auth.device,
+ "x-yoox-api-key": auth.apikey,
+ "x-yoox-cart-token": cart.token,
+ },
+
+ proxy content body
+ proxy method
+ proxy query string
+*/ \ No newline at end of file
diff --git a/proxy/package.json b/proxy/package.json
new file mode 100644
index 00000000..f7304d43
--- /dev/null
+++ b/proxy/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "stone-island-proxy",
+ "version": "1.0.0",
+ "description": "local proxy for stone island api",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "okfocus",
+ "license": "LNT"
+}