Class: Spaceship::ConnectAPI::BundleId

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/bundle_id.rb

Instance Attribute Summary collapse

Attributes included from Model

#id, #reverse_attr_map

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes

Instance Attribute Details

#bundle_id_capabilitiesObject

Returns the value of attribute bundle_id_capabilities.



13
14
15
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 13

def bundle_id_capabilities
  @bundle_id_capabilities
end

#identifierObject

Returns the value of attribute identifier.



8
9
10
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 8

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 9

def name
  @name
end

#platformObject

Returns the value of attribute platform.



11
12
13
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 11

def platform
  @platform
end

#seed_idObject

Returns the value of attribute seed_id.



10
11
12
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 10

def seed_id
  @seed_id
end

Class Method Details

.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

API



42
43
44
45
46
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 42

def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  resps = client.get_bundle_ids(filter: filter, includes: includes).all_pages
  return resps.flat_map(&:to_models)
end

.create(client: nil, name: nil, platform: nil, identifier: nil, seed_id: nil) ⇒ Object



60
61
62
63
64
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 60

def self.create(client: nil, name: nil, platform: nil, identifier: nil, seed_id: nil)
  client ||= Spaceship::ConnectAPI
  resp = client.post_bundle_id(name: name, platform: platform, identifier: identifier, seed_id: seed_id)
  return resp.to_models.first
end

.find(identifier, includes: nil, client: nil) ⇒ Object



48
49
50
51
52
53
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 48

def self.find(identifier, includes: nil, client: nil)
  client ||= Spaceship::ConnectAPI
  return all(client: client, filter: { identifier: identifier }, includes: includes).find do |app|
    app.identifier == identifier
  end
end

.get(client: nil, bundle_id_id: nil, includes: nil) ⇒ Object



55
56
57
58
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 55

def self.get(client: nil, bundle_id_id: nil, includes: nil)
  client ||= Spaceship::ConnectAPI
  return client.get_bundle_id(bundle_id_id: bundle_id_id, includes: includes).first
end

.typeObject



24
25
26
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 24

def self.type
  return "bundleIds"
end

Instance Method Details

#create_capability(capability_type, settings: [], client: nil) ⇒ Object



76
77
78
79
80
81
82
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 76

def create_capability(capability_type, settings: [], client: nil)
  raise "capability_type is required " if capability_type.nil?

  client ||= Spaceship::ConnectAPI
  resp = client.post_bundle_id_capability(bundle_id_id: id, capability_type: capability_type, settings: settings)
  return resp.to_models.first
end

#get_capabilities(client: nil, includes: nil) ⇒ Object

BundleIdsCapabilities



70
71
72
73
74
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 70

def get_capabilities(client: nil, includes: nil)
  client ||= Spaceship::ConnectAPI
  resp = client.get_bundle_id_capabilities(bundle_id_id: id, includes: includes)
  return resp.to_models
end

#supports_catalyst?Boolean

Helpers

Returns:

  • (Boolean)


32
33
34
35
36
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 32

def supports_catalyst?
  return bundle_id_capabilities.any? do |capability|
    capability.is_type?(Spaceship::ConnectAPI::BundleIdCapability::Type::MARZIPAN)
  end
end

#update_capability(capability_type, enabled: false, settings: [], client: nil) ⇒ Object



84
85
86
87
88
89
90
# File 'spaceship/lib/spaceship/connect_api/models/bundle_id.rb', line 84

def update_capability(capability_type, enabled: false, settings: [], client: nil)
  raise "capability_type is required " if capability_type.nil?

  client ||= Spaceship::ConnectAPI
  resp = client.patch_bundle_id_capability(bundle_id_id: id, seed_id: seed_id, enabled: enabled, capability_type: capability_type, settings: settings)
  return resp.to_models.first
end