Sha256: 35b7bf2976aeaf70cd1af0de3c818a785d7e7bbbfb9f89ee2da8443373972834

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

require_relative '../model'
module Spaceship
  class ConnectAPI
    class Device
      include Spaceship::ConnectAPI::Model

      attr_accessor :device_class
      attr_accessor :model
      attr_accessor :name
      attr_accessor :platform
      attr_accessor :status
      attr_accessor :udid
      attr_accessor :added_date

      attr_mapping({
        "deviceClass" => "device_class",
        "model" => "model",
        "name" => "name",
        "platform" => "platform",
        "status" => "status",
        "udid" => "udid",
        "addedDate" => "added_date"
      })

      module DeviceClass
        APPLE_WATCH = "APPLE_WATCH"
        IPAD = "IPAD"
        IPHONE = "IPHONE"
        IPOD = "IPOD"
        APPLE_TV = "APPLE_TV"
        MAC = "MAC"
      end

      module Status
        ENABLED = "ENABLED"
        DISABLED = "DISABLED"
      end

      def self.type
        return "devices"
      end

      #
      # API
      #

      def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
        resps = Spaceship::ConnectAPI.get_devices(filter: filter, includes: includes).all_pages
        return resps.flat_map(&:to_models)
      end

      def self.create(name: nil, platform: nil, udid: nil)
        resp = Spaceship::ConnectAPI.post_device(name: name, platform: platform, udid: udid)
        return resp.to_models.first
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-2.167.0 spaceship/lib/spaceship/connect_api/models/device.rb
fastlane-2.166.0 spaceship/lib/spaceship/connect_api/models/device.rb
fastlane-2.165.0 spaceship/lib/spaceship/connect_api/models/device.rb
fastlane-2.164.0 spaceship/lib/spaceship/connect_api/models/device.rb
fastlane-2.163.0 spaceship/lib/spaceship/connect_api/models/device.rb