title | vendor | price | price_comparison | weight_in_grams | status | product_type | variant | sku | stock | available_if_no_stock
---------------------|-------------|---------|-------------------|------------------|----------|----------------|-------------|-----|-------|------------------
Zapatillas de fútbol | Adidas | 1000 | 1200 | 300 | visible | Calzado | 39 | ABC | 10 | true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'fileutils' | |
## USAGE | |
# S=<subdominio> bootic runner images.rb | |
# | |
subdomain = ENV.fetch('S') | |
s = root.all_shops(subdomains: subdomain).first | |
prs = s.products(status: 'all').full_set | |
shop_dir = File.join(".", subdomain) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('util'); | |
function value (obj, path) { | |
var segments = path.split('/') | |
if(segments[0] == '') segments = segments.slice(1) | |
return segments.reduce(function (memo, segment) { | |
return (typeof memo == 'object') ? memo[segment] : {} | |
}, obj) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# asume un directorio ./imgs/ junto a este script | |
# correr con | |
# SUBDOMAIN=acme bootic runner bootic_images_upload.rb | |
# sólo importa a productos con este tag | |
TAG = 'import20171115'.freeze | |
def errors(errs) | |
errs.map{|e| [e.field, e.messages.first].join(': ')} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple thread-safe IoC container | |
# Example | |
# | |
# DEPS = Container.new | |
# # db singleton is lazily initialized if needed | |
# DEPS.register(:db) do | |
# require 'sequel' | |
# Sequel.connect ENV.fetch('DATABASE_URL') | |
# end | |
# database-backed repo depends on :db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'typhoeus' | |
require 'json' | |
require 'base64' | |
require 'fileutils' | |
# theme = GithubTheme.new( | |
# repo_url: "https://api.github.com/repos/bootic/theme_gallery/contents/snap", | |
# credentials: "user:token" | |
# ) | |
# puts 'TEMPLATES' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order_code = 'ABCXXX' | |
variant_id = 123 | |
variant_units = 3 # unidades a agregar | |
# encuentra pedido existente | |
order = shop.order(id: order_code) # si no existe, creamos una nueva | |
# construimos un array de line_items | |
# a partir de los items del pedido existente | |
# si es que la variante que queremos agregar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datos = shop.create_product( | |
title: ‘un nombre que ya existe’, | |
price: 1234, | |
_policies: { | |
ensure_unique: ‘title’ | |
} | |
) | |
if datos.has?(:errors) | |
if datos.has?(:current_entity) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.3.1 | |
MAINTAINER Ismael Celis "[email protected]" | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev apt-transport-https apt-utils | |
RUN apt-get install -y mysql-client | |
# for nokogiri | |
RUN apt-get install -y libxml2-dev libxslt1-dev | |
# for a JS runtime | |
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>grid</title> | |
<style> | |
body {padding: 0; margin: 0;} | |
.container { | |
display: grid; | |
grid-template-rows: 200px repeat(4, 100px); | |
grid-template-columns: repeat(4, 1fr); | |
grid-template-areas: "header header header header" |