Class: Dennis::RecordType

Inherits:
Object
  • Object
show all
Defined in:
lib/dennis/record_type.rb

Defined Under Namespace

Classes: ContentAttribute, ContentAttributeOption

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ RecordType

Returns a new instance of RecordType.



18
19
20
# File 'lib/dennis/record_type.rb', line 18

def initialize(hash)
  @hash = hash
end

Class Method Details

.all(client) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/dennis/record_type.rb', line 8

def all(client)
  request = client.api.create_request(:get, 'record_types')
  request.perform.hash['record_types'].each_with_object({}) do |rt, hash|
    type = new(rt)
    hash[type.name] = type
  end
end

Instance Method Details

#content_attributesObject



38
39
40
41
42
# File 'lib/dennis/record_type.rb', line 38

def content_attributes
  @hash['content_attributes'].map do |hash|
    ContentAttribute.new(hash)
  end
end

#exposed?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/dennis/record_type.rb', line 34

def exposed?
  @hash['exposed'] == true
end

#managed_only?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/dennis/record_type.rb', line 30

def managed_only?
  @hash['managed_only'] == true
end

#nameObject



22
23
24
# File 'lib/dennis/record_type.rb', line 22

def name
  @hash['name']
end

#requires_priority?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/dennis/record_type.rb', line 26

def requires_priority?
  @hash['requires_priority'] == true
end