spaceship/lib/spaceship/portal/app.rb in fastlane-2.52.0.beta.20170808010002 vs spaceship/lib/spaceship/portal/app.rb in fastlane-2.52.0.beta.20170809010003
- old
+ new
@@ -69,22 +69,14 @@
'associatedCloudContainersCount' => :cloud_containers_count,
'associatedIdentifiersCount' => :identifiers_count
)
class << self
- # Create a new object based on a hash.
- # This is used to create a new object based on the server response.
- def factory(attrs)
- obj = self.new(attrs)
- obj.unfold_associated_groups(attrs['associatedApplicationGroups'])
- return obj
- end
-
# @param mac [Bool] Fetches Mac apps if true
# @return (Array) Returns all apps available for this account
def all(mac: false)
- client.apps(mac: mac).map { |app| self.factory(app) }
+ client.apps(mac: mac).map { |app| self.new(app) }
end
# Creates a new App ID on the Apple Dev Portal
#
# if bundle_id ends with '*' then it is a wildcard id otherwise, it is an explicit id
@@ -112,13 +104,15 @@
return app if app.bundle_id.casecmp(bundle_id) == 0
end
end
end
- def unfold_associated_groups(attrs)
- return unless attrs
- unfolded_associated_groups = attrs.map { |info| Spaceship::Portal::AppGroup.new(info) }
- instance_variable_set(:@associated_groups, unfolded_associated_groups)
+ def associated_groups
+ return unless raw_data.key?('associatedApplicationGroups')
+
+ @associated_groups ||= raw_data['associatedApplicationGroups'].map do |info|
+ Spaceship::Portal::AppGroup.new(info)
+ end
end
# Delete this App ID. This action will most likely fail if the App ID is already in the store
# or there are active profiles
# @return (App) The app you just deletd