Sha256: 5f56b361b5f735e4b83a6ac4f22a4a7375c002297082f8c51519373465480f4d

Contents?: true

Size: 618 Bytes

Versions: 5

Compression:

Stored size: 618 Bytes

Contents

module SimpleMDM
  class DeviceGroup < Base

    def self.all
      hash, code = fetch("device_groups")

      hash['data'].collect { |d| build d }
    end

    def self.find(id)
      hash, code = fetch("device_groups/#{id}")

      build hash['data']
    end

    def add_device(device)
      raise "The object you provided is not a device" unless device.kind_of?(SimpleMDM::Device)

      hash, code = fetch("device_groups/#{self.id}/devices/#{device.id}", :post)

      if code == 204
        self['device_ids'] = self['device_ids'] | [device.id]
        true
      else
        false
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
fastlane-plugin-simplemdm-0.1.0 lib/simplemdm/device_group.rb
simplemdm-1.3.0 lib/simplemdm/device_group.rb
simplemdm-1.2.0 lib/simplemdm/device_group.rb
simplemdm-1.1.3 lib/simplemdm/device_group.rb
simplemdm-1.1.2 lib/simplemdm/device_group.rb