Sha256: 0160063b83d2712cf7ef285128f787d2082b6928dcbe1b136f7fb13f00298910

Contents?: true

Size: 910 Bytes

Versions: 4

Compression:

Stored size: 910 Bytes

Contents

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

        def get(id)
          request("devices/#{id}")
        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={})
          request("devices/find/#{make_filter(filter)}")
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
onering-client-0.0.10 lib/onering/plugins/devices.rb
onering-client-0.0.9 lib/onering/plugins/devices.rb
onering-client-0.0.8 lib/onering/plugins/devices.rb
onering-client-0.0.7 lib/onering/plugins/devices.rb