Skip to content

Instantly share code, notes, and snippets.

@sebabelmar
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebabelmar/0f40b9fdc81aa4919de5 to your computer and use it in GitHub Desktop.
Save sebabelmar/0f40b9fdc81aa4919de5 to your computer and use it in GitHub Desktop.
var request = require('request');
getCategories = function() {
request({
uri: "https://api.scalablepress.com/v2/products/anvil-100-cotton-t-shirt",
method: "GET",
timeout: 10000,
followRedirect: true,
maxRedirects: 10,
}, function(err, response, body){
var dribbbleUserResponse = JSON.parse(body)
console.log(dribbbleUserResponse );
debugger;
});
};
// var quote_object = {
// "type": "dtg",
// "designId": data.designId,
// "sides": {
// "front": 1,
// "back": -1,
// "right": -1,
// "left": -1
// },
// "product": {
// "id": "anvil-100-cotton-t-shirt",
// "color": random.color,
// "size": seleceted.size,
// "quantity": 1
// },
// "address": {
// "name": drapppr.name,
// "company": drapppr.company,
// "address1": drapppr.address1,
// "address2": drapppr.address2,
// "city": drapppr.city,
// "state": drapppr.state,
// "zip": drapppr.number,
// "country": drapppr.string
// }
// }
// var order_object = {
// "type": "dtg",
// "designId": product.designId,
// "sides": {
// "front": 1,
// "back": -1,
// "right": -1,
// "left": -1
// },
// "product": {
// "id": "anvil-100-cotton-t-shirt",
// "color": product.color,
// "size": product.size,
// "quantity": 1
// },
// "address": {
// "name": customer.name,
// "company": customer.company,
// "address1": customer.address1,
// "address2": customer.address2,
// "city": customer.city,
// "state": customer.state,
// "zip": customer.number,
// "country": customer.string
// }
// }
// }
var design = {
type: "dtg",
sides: {
front: {
artwork: "https://dl.dropboxusercontent.com/u/77430963/One%20Circle%20Layer%20Style%20-%20Star-Planet.png",
dimensions: {width: 5}
}
}
};
postDesign = function(design){
request.post('https://api.scalablepress.com/v2/design', {
'auth': {
'user': '',
'pass': '2e93f7ea8b4dcd09a0e72df2a7ec0d70'
},
json: true,
body: design
}, function (err, res, body) {
console.log(res.statusCode, body);
});
}
var quote = {
type: "dtg",
designId: "53f0cdf64a686b292500395a",
sides: {front: 1},
products: [{
id: "anvil-100-cotton-t-shirt",
color: "white",
size: "lrg",
quantity: 1
}],
address: {
name: "test",
company: "test",
address1: "test",
address2: "test",
city: "test",
state: "test",
zip: "test",
country: "US"
}
}
postQuote = function(quote){
request.post('https://api.scalablepress.com/v2/quote', {
'auth': {
'user': '',
'pass': '2e93f7ea8b4dcd09a0e72df2a7ec0d70'
},
json: true,
body: quote
}, function (err, res, body) {
console.log(res.statusCode, body);
});
}
var order = {
orderToken: "DYNAMIC_TOKEN",
shipingAddress: {
name: "Seba",
company: "Seba",
address1: "3145 Octavia ST",
address2: "Apt 1",
city: "San Francisco",
state: "CA",
zip: "94123",
country: "US"
}
}
postOrder = function(order){
request.post('https://api.scalablepress.com/v2/order', {
'auth': {
'user': '',
'pass': '2e93f7ea8b4dcd09a0e72df2a7ec0d70'
},
json: true,
body: order
}, function (err, res, body) {
console.log(res.statusCode, body);
});
}
// getCategories();
console.log("seba");
// postDesign(design);
postQuote(quote);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment