dealmap

package module
v0.0.0-...-d079358 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2012 License: Apache-2.0 Imports: 7 Imported by: 0

README

go-dealmap is an API library written in go for accessing the DealMap service.

For more information about the DealMap API, see:

http://www.thedealmap.com/api/

For more information about Go, see:

http://golang.org/

Current Status:

Google has acquired The Deal Map, and shut down the API in favor of Google Offers. Thus, don't expect further updates to this project.

Documentation

Index

Constants

View Source
const (
	Kids      = 1
	Group     = 8
	Romantic  = 16
	Casual    = 64
	Fun       = 512
	LateNight = 16384
	Outdoor   = 32768
)

Centered activity Values

View Source
const (
	GiftCertificate = 1
	BOGO            = 2
	PrintableCoupon = 4
	GroupBuy        = 8
	DailyDeal       = 16
	FreeDeal        = 32
)

Deal types

View Source
const (
	Favorite           = 1  // Favorited by The Dealmap Deal Editors
	HasTransaction     = 2  // Involves some kind of purchase
	Featured           = 4  // This deal is featured on The Dealmap
	Exclusive          = 8  // This deal is exclusively available only at The Dealmap
	FiftyPercentOrMore = 16 // This deal has 50  or more % savings
	CanBePrinted       = 32 // This is a printable coupon
	Affiliate          = 64 // Affiliate
)

Deal capability values

View Source
const (
	Price      = 1
	Percentage = 2
)

Deal units

View Source
const (
	USD = 1
	GBP = 2
	EUR = 3
)

Deal currency

View Source
const (
	ApiUrl = "http://api.thedealmap.com"
)

Dealmap API information

View Source
const (
	Unknown = 0
)

Unknown value

Variables

This section is empty.

Functions

This section is empty.

Types

type Business

type Business struct {
	Activity     int
	AddressLine  string
	Capability   int
	Category     string
	City         string
	Country      string
	Franchise    string
	ID           string
	Latitude     float64
	Longitude    float64
	MoreInfoLink string
	Phone        string
	Ratings      float64
	Reviews      int
	State        string
	Title        string
}

Business contains the details of a business in TheDealMap. See the API documentation for details.

type Businesses

type Businesses struct {
	Message      string     // Message from API, usually indicating a problem of some kind
	Results      []Business `xml:"Results>Business"` // List of Business objects
	TotalResults int        // Total number of results
}

Businesses is an API response containing a list of Business objects and a response message

type Deal

type Deal struct {
	Activity                               int
	AddedBy                                string
	AdditionalDiscountCouponCode           string
	AdditionalDiscountCouponEffectiveTime  string
	AdditionalDiscountCouponExpirationTime string
	AdditionalDiscountDealUnit             int
	AdditionalDiscountedValue              int
	AddressLine                            string
	Affiliation                            string
	BDescription                           string
	BusinessID                             string
	BusinessName                           string
	Capability                             int
	Category                               string
	City                                   string
	Country                                string
	Currency                               int
	DealSource                             string
	DealType                               int
	DealUnit                               int
	Description                            string
	DiscountedValue                        float64
	EffectiveTime                          string
	ExpirationTime                         string
	FaceValue                              float64
	ID                                     string
	IconUrl                                string
	ImageUrl                               string
	IsSoldOut                              bool
	Keywords                               string
	Latitude                               float64
	Longitude                              float64
	MoreInfoLink                           string
	Phone                                  string
	Ratings                                float64
	ReviewCount                            int
	SoldCount                              int
	State                                  string
	Tags                                   string
	Terms                                  string
	Title                                  string
	TrackingUrl                            string
	TransactionUrl                         string
	YouSave                                string
	ZipCode                                string
}

A Deal contains all the details of a single deal. See TheDealMap API documentation for details.

func (*Deal) ParseAdditionalDiscountCouponEffectiveTime

func (d *Deal) ParseAdditionalDiscountCouponEffectiveTime() (time.Time, error)

Attempts to parse the additional discount coupon's effective time

func (*Deal) ParseAdditionalDiscountCouponExpirationTime

func (d *Deal) ParseAdditionalDiscountCouponExpirationTime() (time.Time, error)

Attempts to parse the additional discount coupon's expiration time

func (*Deal) ParseEffectiveTime

func (d *Deal) ParseEffectiveTime() (time.Time, error)

Attempts to parse the deal's effective time

func (*Deal) ParseExpirationTime

func (d *Deal) ParseExpirationTime() (time.Time, error)

Attempts to parse the deal's expiration time

type DealMap

type DealMap struct {
	// contains filtered or unexported fields
}

DealMap class to used to communicate with the API

func New

func New(apiUrl string, client *http.Client, apiKey string) *DealMap

Creates a new DealMap object using the given HTTP client and API key

func (*DealMap) DealDetails

func (dm *DealMap) DealDetails(id string) (*Deal, error)

DealDetails invokes the "deal details" API from TheDeapMap and returns the response as a Deal object.

func (*DealMap) SearchBusinesses

func (dm *DealMap) SearchBusinesses(location string, query string, distanceMi int, startIndex int, pageSize int, activity int) (*Businesses, error)

SearchBusinesses invokes the "search businesses" API from TheDealMap and returns the response as a Businesses object.

func (*DealMap) SearchDeals

func (dm *DealMap) SearchDeals(location string, query string, distanceMi int, startIndex int, pageSize int, activity int, capability int, expirationDate time.Time) (*Deals, error)

SearchDeals invokes the "search deals" API from TheDealMap and returns the response as a Deals object.

type Deals

type Deals struct {
	Message      string // Message from API, usually indicating a problem of some kind
	Results      []Deal `xml:"Results>Deal"` // List of Deal objects
	TotalResults int    // Total number of results
}

Deals is an API response containing a list of deals and an API message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL