Class: Unit::Types::RestrictedResource

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/types/restricted_resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ids, type) ⇒ RestrictedResource

Returns a new instance of RestrictedResource.



9
10
11
12
# File 'lib/unit/types/restricted_resource.rb', line 9

def initialize(ids, type)
  @ids = ids
  @type = type
end

Instance Attribute Details

#idsObject (readonly)

Returns the value of attribute ids.



7
8
9
# File 'lib/unit/types/restricted_resource.rb', line 7

def ids
  @ids
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/unit/types/restricted_resource.rb', line 7

def type
  @type
end

Instance Method Details

#to_json_apiObject



14
15
16
17
18
19
20
# File 'lib/unit/types/restricted_resource.rb', line 14

def to_json_api
  result = []
  @ids.each do |id|
    result << { type: type, id: id }
  end
  result
end