Sha256: 72b600443954e7418e718eead603c70fbfc9655d219c157c49589c82c5c5499e

Contents?: true

Size: 1.29 KB

Versions: 16

Compression:

Stored size: 1.29 KB

Contents

require_relative './util.rb'
require "spaceship"
require 'terminal-table'

module Slowlane
  module Portal
    class Device < Thor

      desc "list", "List devices"
      def list()

        c=Utils.credentials(options)
        Spaceship::Portal.login(c.username,c.password)

        t=Utils.team(options)
        Spaceship::Portal.client.team_id=t

        headings = [ 'id', 'udid', 'description' ,'status', 'platform', 'model', 'device_type']
        rows = []
        Spaceship::Portal.device.all.find_all do |device|
          row = []
          row << device.id
          row << device.udid
          row << device.name
          row << device.status
          row << device.platform
          row << device.model
          row << device.device_type
          rows << row
        end

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

      end

      desc "add", "Add a device <udid> <description>"
      def add(udid, description)

        c=Utils.credentials(options)
        Spaceship::Portal.login(c.username,c.password)

        t=Utils.team(options)
        Spaceship::Portal.client.team_id=t

        newdevice = Spaceship::Portal.device.create!(name: "#{description}", udid: "#{udid}")
        require 'pp'
        pp newdevice

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
slowlane-1.2.5 lib/slowlane/portal/device.rb
slowlane-1.2.4 lib/slowlane/portal/device.rb
slowlane-1.2.3 lib/slowlane/portal/device.rb
slowlane-1.2.2 lib/slowlane/portal/device.rb
slowlane-1.2.1 lib/slowlane/portal/device.rb
slowlane-1.2.0 lib/slowlane/portal/device.rb
slowlane-1.1.1 lib/slowlane/portal/device.rb
slowlane-1.1.0 lib/slowlane/portal/device.rb
slowlane-1.0.1 lib/slowlane/portal/device.rb
slowlane-1.0.0 lib/slowlane/portal/device.rb
slowlane-0.0.9 lib/slowlane/portal/device.rb
slowlane-0.0.8 lib/slowlane/portal/device.rb
slowlane-0.0.6 lib/slowlane/portal/device.rb
slowlane-0.0.5 lib/slowlane/portal/device.rb
slowlane-0.0.4 lib/slowlane/portal/device.rb
slowlane-0.0.3.alpha lib/slowlane/portal/device.rb