ruby/siteflow_api.rb
# Creates a mock order to test validate and submission of an order
#
# Note: "hp.jpeng" will need to be changed to your own printos account username
Creates a mock order to test validate and submission of an order
Note: "hp.jpeng" will need to be changed to your own printos account username
Creates a mock order to test validate and submission of an order Note : " hp . jpeng " will need to be changed to your own printos account username
def create_order()
	{
		"destination" => {
			"name" => "hp.jpeng"
		},
		"orderData" => {
			"sourceOrderId" => [*('A'..'Z')].sample(8).join,
			"items" => [{
				"sourceItemId" => [*('A'..'Z')].sample(8).join,
				"sku" => "Flat",
				"quantity" => 1,
				"components" => [{
					"code" => "Content",
					"path" => "https://Server/Path/business_cards.pdf",
					"fetch" => "true",
				}],
			}],
			"shipments" => [{
				"shipTo" => {
					"name" => "John Doe",
					"address1" => "5th Avenue",
					"town" => "New York",
					"postcode" => "12345",
					"state" => "New York",
					"isoCountry" => "US",
					"email" => "johnd@acme.com",
					"phone" => "01234567890"
				},
				"carrier" => {
					"code" => "customer",
					"service" => "shipping"
				}
			}]
		}
	}.to_json()
end
def create_order ( ) { "destination" => { "name" => "hp.jpeng" } , "orderData" => { "sourceOrderId" => [ * ( 'A' .. 'Z' ) ] . sample ( 8 ) . join , "items" => [ { "sourceItemId" => [ * ( 'A' .. 'Z' ) ] . sample ( 8 ) . join , "sku" => "Flat" , "quantity" => 1 , "components" => [ { "code" => "Content" , "path" => "https://Server/Path/business_cards.pdf" , "fetch" => "true" , } ] , } ] , "shipments" => [ { "shipTo" => { "name" => "John Doe" , "address1" => "5th Avenue" , "town" => "New York" , "postcode" => "12345" , "state" => "New York" , "isoCountry" => "US" , "email" => "johnd@acme.com" , "phone" => "01234567890" } , "carrier" => { "code" => "customer" , "service" => "shipping" } } ] } } . to_json ( ) end
Creates a mock order to test validate and submission of an order
Note: "hp.jpeng" will need to be changed to your own printos account username
Creates a mock order to test validate and submission of an order Note : " hp . jpeng " will need to be changed to your own printos account username
# "route" => [{ # 		"name" => "Print", # 		"eventTypeId" => ""		#eventTypeId found within Site Flow -> Events # 	}, { # 		"name" => "Cut", # 		"eventTypeId" => "" # 	}, { # 		"name" => "Laminate", # 		"eventTypeId" => "" # 	}, { # 		"name" => "Finish", # 		"eventTypeId" => "" # }]