Sha256: 521ab09b1c8d4b8969eace39706418dc4caf485b49e62a0f5bfa74348e47f509

Contents?: true

Size: 625 Bytes

Versions: 1

Compression:

Stored size: 625 Bytes

Contents

require 'kegbot_api/nouns/remote_rest_noun'

module KegbotApi
  class Drink < RemoteRestNoun
    id      :id
    float   :volume_ml
    time    :time
    integer :duration
    has_one :keg
    has_one :session

    def self.all
      list(get("#{self.client.base_url}/drinks"))
    end

    def self.find(id, *args)
      one(get("#{self.client.base_url}/drinks/#{id}"))
    end

    def to_s
      "#<#{self.class.to_s}:#{"0x%x" % object_id} @id=#{self.id.inspect}>"
    end

    def self.to_s
      self.client ? "KegbotApi::Drink<#{self.client.base_url}>" : super
    end

    def self.inspect
      to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kegbot_api-0.0.1 lib/kegbot_api/nouns/drink.rb