Skip to content

Instantly share code, notes, and snippets.

@flsafe
flsafe / initialspec
Created November 14, 2013 22:05
Adforge API v2 spec
Ads API V2
Returns 422 if a valid publisher_id is not specified
Returns 422 if business_ids and phone_numbers are not specified
When it's a business ads query
Only returns ads with start_date <= the current date
Returns ads by business phone numbers
Returns ads by business ids
returns an array of json objects with the following keys: id, job_id, batch_id, text, business, pdf, large, slider
thumb, hover, url, start_date, end_date
when both business_id and phone are provided
Search index:
"All American Dogs Hot Dog Coney Dog Coney Cheese Dog A&w Burgers Papa Burger Original Bacon Double Cheeseburger Original Bacon Cheeseburger Cheeseburger Hamburger Chicken Mama's Recipe Chicken Crispy Chicken Sandwich Grilled Chicken Sandwich Chicken Strips Sides Fries Chili Cheese Fries Onion Rings Cheese Curds Onion Rings Sweets & Treats A&w Root Beer Float Famous Floats Shakes Soft Serve Cones Sundaes"
Or search index, slower but more rich:
"All American Dog Topped Just the Way You Like for a Satisfying Taste That's Bursting with Flavor All American Dogs our big & beefy hot dog are made piping hot and served on our special bun. Hot Dog an a&w original. the great american hot dog with our own meaty chili sauce and sweet onions. Coney Dog it's hard to believe that the coney dog could get may better but top it with creamy cheese sauce and it's one special treat. Coney Cheese Dog Big, Juicy 100% U.s. Beef Burgers Loaded with Delicious Toppings, Available Only At Your Neighborhood A&w A&w Burg
@flsafe
flsafe / refresh.rb
Created August 29, 2012 18:44
refresh ads
pdfs=[
"864546-01.pdf",
"869017-01.pdf",
"869017-01.pdf",
"867131-01.pdf",
"867131-01.pdf",
"865896-01.pdf",
"865896-01.pdf",
"863510-01.pdf",
"863510-01.pdf",
ubuntu@domU-12-31-38-00-90-C5:/mnt/adftp/done/leesburg_dailycommercial$ ack-grep -A 15 '08102900'
2012-05-14/Default_5-14-12.xml
333: <CUSTOMERNUMBER><![CDATA[08102900]]></CUSTOMERNUMBER>
334- <FIRSTNAME><![CDATA[]]></FIRSTNAME>
335- <LASTNAME><![CDATA[]]></LASTNAME>
336- <COMPANYNAME><![CDATA[LEADING EDGE-VAZIRI]]></COMPANYNAME>
337- <ADDRSS1><![CDATA[10601 US HWY 441C-1B]]></ADDRSS1>
338- <ADDRSS2><![CDATA[]]></ADDRSS2>
339- <CITY><![CDATA[LEESBURG]]></CITY>
340- <STATE><![CDATA[]]></STATE>
require 'spec_helper'
describe CustomerZipCode
describe "#import_businesses" do
it "queries the spelunkerUBL data api"
it "builds a business for each record returned from the spelunkerUBL data"
it "normalizes each business returned from the spelunkerUBL data"
it "categorizes each business return from the spelunkerUBL data"
it "saves each business built from the spelunkerUBL data"
context "a business from the splunkerUBL data already exists and is has a paid listing" do
# NOTE !!
# Works only if you do NOT have the require cucumber step in your Rakefile
# ci_reporter 1.7 crashes on the command `rake ci:setup:cucumber cucumber`.
# I've followed the instuctions here https://github.com/nicksieger/ci_reporter/issues/4
# and created my own ci:setup:cucumber rake task.
# And this seems to have solved the issue.
namespace :ci do
namespace :setup do
Given /^I am an authorized publisher admin$/i do
@publisher = Factory.create(:publisher)
@mp_config = Factory.create(:marketplace_config,
:url => 'localhost',
:publisher => @publisher)
@admin = Factory.create :publisher_admin
@admin.publishers << @publisher
@admin.save
-106.4930386454095,31.75567039469036,0
-106.4933067789597,31.75559907548127,0
-106.4935185215678,31.7555546939303,0
-106.4937444379161,31.75548291296306,0
-106.4936977010694,31.75529720909734,0
-106.4935596464942,31.75511143605309,0
-106.4935513241208,31.75509688691311,0
-106.4933316389852,31.75497188353929,0
-106.4930651746005,31.75477986665801,0
-106.492657129873,31.75461401608551,0
SOAP request: https://gateway.cygnustrack.com/Gateway.asmx
SOAPAction: "http://YourDomainName.com/PostDeviceMessage", Content-Type: text/xml;charset=UTF-8, Content-Length: 1013
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://YourDomainName.com/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><PostDeviceMessage><apiKey>c7e91427-0bbc-47a0-be99-14f4a1d161f1</apiKey><xmlMessage>&lt;LocationMessage&gt;
&lt;DeviceId&gt;80c96863-1e37-4&lt;/DeviceId&gt;
&lt;UtcDateTime&gt;2011-08-12 05:50:17 UTC&lt;/UtcDateTime&gt;
&lt;Longitude&gt;31.75497188353929&lt;/Longitude&gt;
&lt;Latitude&gt;-106.4933316389852&lt;/Latitude&gt;
&lt;GpsAccuracyInMeters&gt;20&lt;/GpsAccuracyInMeters&gt;
&lt;AltitudeInMeters&gt;0&lt;/AltitudeInMeters&gt;
&lt;SpeedInKph&gt;10&lt;/SpeedInKph&gt;
LAWN_CARE_SIC = "0782"
def get_sic_code(sic)
SicCode.first(sic_code:sic)
end
def fix_lawn_care_sic
sic_code = get_sic_code(LAWN_CARE_SIC)
sic_code.category = GCS::Category.first_by_title('lawn-and-garden')
sic_code.sub_category = GCS::SubCategory.first_by_title('lawn-care')