Class: IOSPortal::Client
- Inherits:
-
Object
- Object
- IOSPortal::Client
- Defined in:
- lib/ios-portal/client.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #devices(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new API.
- #profiles(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new API
10 11 12 13 14 15 16 17 |
# File 'lib/ios-portal/client.rb', line 10 def initialize(={}) self.username = [:username] self.password = [:password] self.account = [:account] @@agent = Mechanize.new @@agent. = true end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
7 8 9 |
# File 'lib/ios-portal/client.rb', line 7 def account @account end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/ios-portal/client.rb', line 7 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/ios-portal/client.rb', line 7 def username @username end |
Instance Method Details
#devices(options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ios-portal/client.rb', line 37 def devices(={}) if _authenticate page = @@agent.get(IOSPortal::DEVICES_URL) #puts page.parser.xpath('/').to_html profile_devices = [] devices = page.at("div[@class='nt_multi']") raise "No devices" unless devices hidden_name = "" checkbox_name = "" devices.at("tbody").children.each{|row| device = {} row.children.each{|column| case column['class'] when "checkbox" device[:id] = column.children[1]['value'].strip when "name" device[:name] = column.children[1].text.strip when "id" device[:udid] = column.text.strip end } profile_devices.push(device) if device.length > 0 } return profile_devices end end |
#profiles(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ios-portal/client.rb', line 19 def profiles(={}) if _authenticate profiles = {} all = .has_key?(:all) ? [:all] : true if [:development] or all profiles[:development] = development_provisioning_profiles end if [:distribution] or all profiles[:distribution] = distribution_provisioning_profiles end return profiles end end |