Sha256: a580142f35a88adaab252f0ce7200a8421e2a7916216b1ed19c863ae048546fb

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require_relative 'utils'

module Postmates
  class Delivery
    include Postmates::Utils
    attr_reader :id, :created_at, :updated_at, :status, :complete,
                :pickup_eta, :dropoff_eta, :dropoff_deadline,
                :quote_id, :fee, :currency, :manifest, :pickup,
                :dropoff, :courier, :image_url

    def initialize(hash)
      @id          =         hash['id']
      @status      =         hash['status']
      @complete    =         hash['complete']
      @quote_id    =         hash['quote_id']
      @fee         =         hash['fee']
      @currency    =         hash['currency']
      @manifest    =         hash['manifest']
      @pickup      =         hash['pickup']
      @dropoff     =         hash['dropoff']
      @courier     =         hash['courier']
      @image_url   =  urlify hash['image_href']
      @created_at  = timeify hash['created']
      @updated_at  = timeify hash['updated']
      @pickup_eta  = timeify hash['pickup_eta']
      @dropoff_eta = timeify hash['dropoff_eta']
    end

    def delivered?
      status == 'delivered'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
postmates-0.1.0 lib/postmates/delivery.rb