Class: Adsedare::Capability

Inherits:
Object
  • Object
show all
Defined in:
lib/adsedare/capabilities.rb

Direct Known Subclasses

AppGroupsCapability, SimpleCapability

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Capability

Returns a new instance of Capability.



61
62
63
# File 'lib/adsedare/capabilities.rb', line 61

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



59
60
61
# File 'lib/adsedare/capabilities.rb', line 59

def type
  @type
end

Instance Method Details

#check?(bundle_info) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
# File 'lib/adsedare/capabilities.rb', line 65

def check?(bundle_info)
  bundle_info["included"].any? {
    |cap|
    cap["type"] == "capabilities" && cap["id"] == @type
  }
end

#to_bundle_capability(bundle_info, team_id) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/adsedare/capabilities.rb', line 72

def to_bundle_capability(bundle_info, team_id)
  return {
           "type" => "bundleIdCapabilities",
           "attributes" => {
             "enabled" => true,
             "settings" => [],
           },
           "relationships" => {
             "capability" => {
               "data" => { "type" => "capabilities", "id" => @type },
             },
           },
         }
end