lib/spaceship/portal/device.rb in spaceship-0.12.2 vs lib/spaceship/portal/device.rb in spaceship-0.12.3

- old
+ new

@@ -32,16 +32,15 @@ # 'iPhone 6', 'iPhone 4 GSM' attr_accessor :model # @return (String) Device type # @example - # 'pc' - Apple TV # 'watch' - Apple Watch # 'ipad' - iPad # 'iphone' - iPhone # 'ipod' - iPod - # 'pc' - Apple TV + # 'tvOS' - Apple TV attr_accessor :device_type attr_mapping({ 'deviceId' => :id, 'name' => :name, @@ -64,11 +63,11 @@ client.devices.map { |device| self.factory(device) } end # @return (Array) Returns all Apple TVs registered for this account def all_apple_tvs - client.devices_by_class('pc').map { |device| self.factory(device) } + client.devices_by_class('tvOS').map { |device| self.factory(device) } end # @return (Array) Returns all Watches registered for this account def all_watches client.devices_by_class('watch').map { |device| self.factory(device) } @@ -85,9 +84,23 @@ end # @return (Array) Returns all iPods registered for this account def all_ipod_touches client.devices_by_class('ipod').map { |device| self.factory(device) } + end + + # @return (Array) Returns all devices that can be used for iOS profiles (all devices except TVs) + def all_ios_profile_devices + all.select { |device| device.device_type != "tvOS" } + end + + # @return (Array) Returns all devices that can be used for iOS profiles (all devices except TVs) + def all_for_profile_type(profile_type) + if profile_type.include? "tvOS" + Spaceship::Device.all_apple_tvs + else + Spaceship::Device.all_ios_profile_devices + end end # @return (Device) Find a device based on the ID of the device. *Attention*: # This is *not* the UDID. nil if no device was found. def find(device_id)