Sha256: 48d9318746bd535db96e5720fa07abe8d83dd456c83f1e9939ae9d5e5cae5caa

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require_relative './util.rb'
require_relative './client.rb'
require 'terminal-table'

module Slowlane
  module Fabric 
    class Device <Thor

      desc "list", "get list of devices"
      def list

        c=Utils.credentials(options)

        fabric = Slowlane::Fabric::Client.new
        fabric.username = c.username
        fabric.password = c.password
        fabric.team = Utils.team(options)


        apps = fabric.list_apps()
        if apps.nil?
          puts "No applications found"
          exit(-1)
        end

        all_devices = []

        testers = fabric.list_testers(nil)
        testers.each do |tester|
          tester_id = tester['id']
          if tester_id.is_a? Integer
            tester_devices = fabric.list_tester_devices(tester_id)
            tester_devices.each do |d|
              d['owner'] = tester['name']
              d['email'] = tester['email']
              all_devices << d
            end
          end

        end

        headings = ['owner','email','id', 'name', 'platform', 'type' , 'os_version', 'transferred']
        rows = []

        all_devices.each do |device|
          row = []

          row << device['owner']
          row << device['email']
          row << device['identifier']
          row << device['model_name']
          row << device['platform']
          row << device['ui_idiom']
          row << device['current_os_version']
          row << device['transferred']

          rows << row
        end

        table = Terminal::Table.new :headings => headings,  :rows => rows
        puts table

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
slowlane-1.2.5 lib/slowlane/fabric/device.rb
slowlane-1.2.4 lib/slowlane/fabric/device.rb
slowlane-1.2.3 lib/slowlane/fabric/device.rb
slowlane-1.2.2 lib/slowlane/fabric/device.rb