Class: CtdDocumentation::ActivitiesObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ctd_documentation/models/activities_object.rb

Overview

ActivitiesObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(description = SKIP, display_type = SKIP, entity = SKIP, id = SKIP, resource_id = SKIP, site_id = SKIP, site_name = SKIP, timestamp = SKIP, type = SKIP, user_id = SKIP, user_name = SKIP) ⇒ ActivitiesObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ctd_documentation/models/activities_object.rb', line 95

def initialize(description = SKIP,
               display_type = SKIP,
               entity = SKIP,
               id = SKIP,
               resource_id = SKIP,
               site_id = SKIP,
               site_name = SKIP,
               timestamp = SKIP,
               type = SKIP,
               user_id = SKIP,
               user_name = SKIP)
  @description = description unless description == SKIP
  @display_type = display_type unless display_type == SKIP
  @entity = entity unless entity == SKIP
  @id = id unless id == SKIP
  @resource_id = resource_id unless resource_id == SKIP
  @site_id = site_id unless site_id == SKIP
  @site_name = site_name unless site_name == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @type = type unless type == SKIP
  @user_id = user_id unless user_id == SKIP
  @user_name = user_name unless user_name == SKIP
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method



14
15
16
# File 'lib/ctd_documentation/models/activities_object.rb', line 14

def description
  @description
end

#display_typeString

TODO: Write general description for this method



18
19
20
# File 'lib/ctd_documentation/models/activities_object.rb', line 18

def display_type
  @display_type
end

#entityEntity

TODO: Write general description for this method



22
23
24
# File 'lib/ctd_documentation/models/activities_object.rb', line 22

def entity
  @entity
end

#idInteger

TODO: Write general description for this method



26
27
28
# File 'lib/ctd_documentation/models/activities_object.rb', line 26

def id
  @id
end

#resource_idString

TODO: Write general description for this method



30
31
32
# File 'lib/ctd_documentation/models/activities_object.rb', line 30

def resource_id
  @resource_id
end

#site_idInteger

TODO: Write general description for this method



34
35
36
# File 'lib/ctd_documentation/models/activities_object.rb', line 34

def site_id
  @site_id
end

#site_nameString

TODO: Write general description for this method



38
39
40
# File 'lib/ctd_documentation/models/activities_object.rb', line 38

def site_name
  @site_name
end

#timestampString

TODO: Write general description for this method



42
43
44
# File 'lib/ctd_documentation/models/activities_object.rb', line 42

def timestamp
  @timestamp
end

#typeInteger

TODO: Write general description for this method



46
47
48
# File 'lib/ctd_documentation/models/activities_object.rb', line 46

def type
  @type
end

#user_idString

TODO: Write general description for this method



50
51
52
# File 'lib/ctd_documentation/models/activities_object.rb', line 50

def user_id
  @user_id
end

#user_nameString

TODO: Write general description for this method



54
55
56
# File 'lib/ctd_documentation/models/activities_object.rb', line 54

def user_name
  @user_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/ctd_documentation/models/activities_object.rb', line 120

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  description = hash.key?('description') ? hash['description'] : SKIP
  display_type = hash.key?('display_type') ? hash['display_type'] : SKIP
  entity = Entity.from_hash(hash['entity']) if hash['entity']
  id = hash.key?('id') ? hash['id'] : SKIP
  resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  user_id = hash.key?('user_id') ? hash['user_id'] : SKIP
  user_name = hash.key?('user_name') ? hash['user_name'] : SKIP

  # Create object from extracted values.

  ActivitiesObject.new(description,
                       display_type,
                       entity,
                       id,
                       resource_id,
                       site_id,
                       site_name,
                       timestamp,
                       type,
                       user_id,
                       user_name)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ctd_documentation/models/activities_object.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['display_type'] = 'display_type'
  @_hash['entity'] = 'entity'
  @_hash['id'] = 'id'
  @_hash['resource_id'] = 'resource_id'
  @_hash['site_id'] = 'site_id'
  @_hash['site_name'] = 'site_name'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['user_id'] = 'user_id'
  @_hash['user_name'] = 'user_name'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/ctd_documentation/models/activities_object.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ctd_documentation/models/activities_object.rb', line 74

def self.optionals
  %w[
    description
    display_type
    entity
    id
    resource_id
    site_id
    site_name
    timestamp
    type
    user_id
    user_name
  ]
end