Class: DeployGate::Xcode::MemberCenters::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/deploygate/xcode/member_centers/device.rb

Constant Summary collapse

REGISTER_NAME_MAX_LENGTH =
50

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(udid, user_name, device_name, member_center) ⇒ DeployGate::Devices::Ios

Parameters:



15
16
17
18
19
20
21
22
# File 'lib/deploygate/xcode/member_centers/device.rb', line 15

def initialize(udid, user_name, device_name, member_center)
  @udid = udid
  @user_name = user_name
  @device_name = device_name
  @member_center = member_center

  @register_name = generate_register_name(@user_name, @device_name)
end

Instance Attribute Details

#device_nameObject (readonly)

Returns the value of attribute device_name.



5
6
7
# File 'lib/deploygate/xcode/member_centers/device.rb', line 5

def device_name
  @device_name
end

#member_centerObject (readonly)

Returns the value of attribute member_center.



5
6
7
# File 'lib/deploygate/xcode/member_centers/device.rb', line 5

def member_center
  @member_center
end

#register_nameObject

Returns the value of attribute register_name.



6
7
8
# File 'lib/deploygate/xcode/member_centers/device.rb', line 6

def register_name
  @register_name
end

#udidObject (readonly)

Returns the value of attribute udid.



5
6
7
# File 'lib/deploygate/xcode/member_centers/device.rb', line 5

def udid
  @udid
end

#user_nameObject (readonly)

Returns the value of attribute user_name.



5
6
7
# File 'lib/deploygate/xcode/member_centers/device.rb', line 5

def user_name
  @user_name
end

Instance Method Details

#register!void

This method returns an undefined value.



29
30
31
32
33
# File 'lib/deploygate/xcode/member_centers/device.rb', line 29

def register!
  return if registered?

  @member_center.launcher.device.create!(name: @register_name, udid: @udid)
end

#registered?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/deploygate/xcode/member_centers/device.rb', line 24

def registered?
  !@member_center.launcher.device.find_by_udid(@udid).nil?
end

#to_sString

Returns:

  • (String)


36
37
38
# File 'lib/deploygate/xcode/member_centers/device.rb', line 36

def to_s
  "Name: #{self.register_name}, UDID: #{self.udid}"
end