Sha256: ed8b6b2b80910d6df64114970e56151b72f5c2e43a7486e82b49caaa3c3e974f

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

require_relative 'utils'

module Postmates
  class Quote
    include Postmates::Utils
    attr_reader :id, :created_at, :expires_at, :fee,
                :currency, :dropoff_eta, :duration

    def initialize(hash)
      @id          =         hash['id']
      @fee         =         hash['fee']
      @currency    =         hash['currency']
      @duration    =         hash['duration']
      @created_at  = timeify hash['created']
      @expires_at  = timeify hash['expires']
      @dropoff_eta = timeify hash['dropoff_eta']
    end

    def expired?
      Time.now.utc.to_datetime > expires_at
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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