Documentation
¶
Index ¶
- Constants
- func Distance(first, second Coordinate) float64
- type Coordinate
- type DeliveryInfo
- type DeliveryStatus
- type DeliveryStatusToTimeMap
- type DistanceRange
- type Group
- type Item
- type OrderDetails
- type OrderHistory
- type Participant
- type PriceRanges
- type RetryConfig
- type Status
- type Venue
- type VenueName
- type WoltAddr
Constants ¶
View Source
const ( CoordinateKey = "results.0.location.coordinates" PriceRangesKey = "results.0.delivery_specs.delivery_pricing" )
View Source
const DeliveryCoordinatesPath = "details.delivery_info.location.coordinates.coordinates"
Variables ¶
This section is empty.
Functions ¶
func Distance ¶
func Distance(first, second Coordinate) float64
Distance function returns the distance (in meters) between two points of
a given longitude and latitude relatively accurately (using a spherical approximation of the Earth) through the Haversin Distance Formula for great arc distance on a sphere with accuracy for small distances
point coordinates are supplied in degrees and converted into rad. in the func
distance returned is METERS!!!!!! http://en.wikipedia.org/wiki/Haversine_formula
Types ¶
type Coordinate ¶
func CoordinateFromArray ¶
func CoordinateFromArray(coordinateArr []float64) (Coordinate, error)
type DeliveryInfo ¶ added in v1.2.1
type DeliveryInfo struct { Location struct { Coordinates struct { Coordinates []float64 `json:"coordinates"` } `json:"coordinates"` } `json:"location"` }
type DeliveryStatus ¶ added in v1.2.1
type DeliveryStatus string
const (
DeliveryStatusDelivered DeliveryStatus = "delivered"
)
type DeliveryStatusToTimeMap ¶ added in v1.2.1
type DeliveryStatusToTimeMap map[DeliveryStatus]time.Time
func (*DeliveryStatusToTimeMap) UnmarshalJSON ¶ added in v1.2.1
func (deliveryStatusLog *DeliveryStatusToTimeMap) UnmarshalJSON(bytes []byte) error
type DistanceRange ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func NewGroupWithExistingID ¶
func NewGroupWithExistingID(woltAddrs WoltAddr, retryConfig RetryConfig, id string) (*Group, error)
func (*Group) Details ¶
func (g *Group) Details() (*OrderDetails, error)
func (*Group) MarkAsReady ¶
func (*Group) VenueDetails ¶
func (g *Group) VenueDetails(details *OrderDetails) (*Venue, error)
type OrderDetails ¶
type OrderDetails struct { Status Status `json:"status"` CreatedAtUnix struct { DateUnix int64 `json:"$date"` } `json:"created_at"` Details struct { VenueID string `json:"venue_id"` DeliveryInfo DeliveryInfo `json:"delivery_info"` } `json:"details"` HostID string `json:"host_id"` Participants []Participant `json:"participants"` Purchase struct { DeliveryEtaUnix struct { DateUnix int64 `json:"$date"` } `json:"delivery_eta"` DeliveryStatus DeliveryStatus `json:"delivery_status"` DeliveryStatusLog DeliveryStatusToTimeMap `json:"delivery_status_log"` PurchaseDatetimeUnix struct { DateUnix int64 `json:"$date"` } `json:"purchase_datetime"` } `json:"purchase"` CreatedAt time.Time `json:"-"` DeliveryEta time.Time `json:"-"` PurchaseDatetime time.Time `json:"-"` ParsedDeliveryCoordinate Coordinate `json:"-"` Host string `json:"-"` }
func ParseOrderDetails ¶ added in v1.2.1
func ParseOrderDetails(orderDetailsJSON []byte) (*OrderDetails, error)
func (*OrderDetails) IsDelivered ¶ added in v1.2.1
func (o *OrderDetails) IsDelivered() bool
func (*OrderDetails) RateByPerson ¶
func (o *OrderDetails) RateByPerson() (map[string]float64, error)
type OrderHistory ¶
type OrderHistory struct {
// contains filtered or unexported fields
}
func (*OrderHistory) DeliveryRateForOrder ¶
func (o *OrderHistory) DeliveryRateForOrder(orderPrettyID string) (int, error)
func (*OrderHistory) GetOrderJsonByID ¶
func (o *OrderHistory) GetOrderJsonByID(orderPrettyID string) (*gabs.Container, bool)
type Participant ¶ added in v1.2.1
type Participant struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Status string `json:"status"` UserID string `json:"user_id"` Basket struct { Items []Item `json:"items"` } `json:"basket"` }
func (*Participant) Name ¶ added in v1.2.1
func (p *Participant) Name() string
type PriceRanges ¶
type PriceRanges struct { BasePrice int `json:"base_price"` DistanceRanges []DistanceRange `json:"distance_ranges"` }
type RetryConfig ¶ added in v1.0.1
type Venue ¶ added in v1.2.1
type Venue struct { Alive uint8 `json:"alive"` Location struct { Coordinates []float64 `json:"coordinates"` } `json:"location"` DeliverySpecs struct { DeliveryEnabled bool `json:"delivery_enabled"` DeliveryPricing PriceRanges `json:"delivery_pricing"` } `json:"delivery_specs"` Names []VenueName `json:"name"` Link string `json:"public_url"` OfflinePeriod struct { End struct { DateUnix int64 `json:"$date"` } `json:"end"` } `json:"offline_period"` Online bool `json:"online"` PreorderEnabled bool `json:"preorder_enabled"` PreorderTimes struct { Delivery map[string][]interface{} `json:"delivery"` } `json:"preorder_times"` City string `json:"city"` Timezone string `json:"timezone"` Name string ParsedCoordinate Coordinate `json:"-"` TimezoneLocation *time.Location `json:"-"` OfflinePeriodEnd time.Time `json:"-"` }
func ParseVenue ¶ added in v1.2.1
func (*Venue) CalculateDeliveryRate ¶ added in v1.2.1
func (v *Venue) CalculateDeliveryRate(source Coordinate) (int, error)
func (*Venue) IsDelivering ¶ added in v1.2.1
func (*Venue) IsOpenForPreorderDelivery ¶ added in v1.2.1
Click to show internal directories.
Click to hide internal directories.