Module: RockRMS::Client::Attribute

Included in:
RockRMS::Client
Defined in:
lib/rock_rms/resources/attribute.rb

Instance Method Summary collapse

Instance Method Details

#create_attribute(description: nil, field_type_id:, entity_type_id:, key:, name:, order: Random.rand(100..1000)) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rock_rms/resources/attribute.rb', line 10

def create_attribute(
  description: nil,
  field_type_id:,
  entity_type_id:,
  key:,
  name:,
  order: Random.rand(100..1000)
)
  options = {
    'FieldTypeId'  => field_type_id,
    'EntityTypeId' => entity_type_id,
    'Key'          => key,
    'Name'         => name,
    'Description'  => description,
    'Order'        => order,

    # Required fields
    'IsSystem'     => false,
    'IsGridColumn' => false,
    'IsMultiValue' => false,
    'IsRequired'   => false,
    'AllowSearch'  => false
  }

  post(attributes_path, options)
end

#list_attributes(options = {}) ⇒ Object



4
5
6
7
8
# File 'lib/rock_rms/resources/attribute.rb', line 4

def list_attributes(options = {})
  Response::Attribute.format(
    get(attributes_path, options)
  )
end