Sha256: b1234c6f1171d25c069a74428ca063cd6b184eff7ef97e76310a9f2f1107aa9d

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

module Onering
  module API
    class Devices < Base
      class<<self
        def connect(host=nil)
          super(host)
        end

        def list(field, options={
          :unique => true,
          :sort   => true,
          :filter => nil
        })
          qs = {
            :q => make_filter(options[:filter])
          } if options[:filter]

          rv = request("devices/list/#{field}", {
            :fields => qs
          })

          rv = rv.uniq if options[:unique]
          rv = rv.sort if options[:sort]

          rv
        end

        def find(filter, options={})
          rv = request("devices/find/#{make_filter(filter)}")
          rv
        end

        def save(id, data)
          request("devices/#{id}", {
            :method => :post,
            :data   => data
          })
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onering-client-0.0.4 lib/onering/plugins/devices.rb