Class: Manifestly::Entity::ChecklistStep

Inherits:
Endpoint show all
Defined in:
lib/manifestly/entity/checklist_step.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Endpoint

client, #client, #create, #delete, get, #path, #save, #update

Methods inherited from Base

attr_accessor, attr_reader, attributes, #attributes, #attributes=, invalid_class_method, invalid_method, #to_h

Constructor Details

#initialize(run, data = {}) ⇒ ChecklistStep

Returns a new instance of ChecklistStep.



35
36
37
38
39
40
# File 'lib/manifestly/entity/checklist_step.rb', line 35

def initialize(run, data = {})
  raise 'invalid checklist run' unless run.is_a?(ChecklistRun)

  @parent = run
  super(data)
end

Instance Attribute Details

#assignee_avatar_urlObject

Returns the value of attribute assignee_avatar_url.



8
9
10
# File 'lib/manifestly/entity/checklist_step.rb', line 8

def assignee_avatar_url
  @assignee_avatar_url
end

#assignee_idObject

Returns the value of attribute assignee_id.



9
10
11
# File 'lib/manifestly/entity/checklist_step.rb', line 9

def assignee_id
  @assignee_id
end

#assignee_nameObject

Returns the value of attribute assignee_name.



10
11
12
# File 'lib/manifestly/entity/checklist_step.rb', line 10

def assignee_name
  @assignee_name
end

#assignee_simple_display_nameObject

Returns the value of attribute assignee_simple_display_name.



12
13
14
# File 'lib/manifestly/entity/checklist_step.rb', line 12

def assignee_simple_display_name
  @assignee_simple_display_name
end

#assignee_user_idObject

Returns the value of attribute assignee_user_id.



11
12
13
# File 'lib/manifestly/entity/checklist_step.rb', line 11

def assignee_user_id
  @assignee_user_id
end

#commentsObject

Returns the value of attribute comments.



14
15
16
# File 'lib/manifestly/entity/checklist_step.rb', line 14

def comments
  @comments
end

#completed_atObject

Returns the value of attribute completed_at.



13
14
15
# File 'lib/manifestly/entity/checklist_step.rb', line 13

def completed_at
  @completed_at
end

#dataObject

Returns the value of attribute data.



15
16
17
# File 'lib/manifestly/entity/checklist_step.rb', line 15

def data
  @data
end

Returns the value of attribute description_with_links.



16
17
18
# File 'lib/manifestly/entity/checklist_step.rb', line 16

def description_with_links
  @description_with_links
end

#header_stepObject

Header step needs to always be a boolean (even if not set)



43
44
45
# File 'lib/manifestly/entity/checklist_step.rb', line 43

def header_step
  @header_step
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/manifestly/entity/checklist_step.rb', line 7

def id
  @id
end

#late_atObject

Returns the value of attribute late_at.



19
20
21
# File 'lib/manifestly/entity/checklist_step.rb', line 19

def late_at
  @late_at
end

#pictureObject

Returns the value of attribute picture.



26
27
28
# File 'lib/manifestly/entity/checklist_step.rb', line 26

def picture
  @picture
end

#positionObject

Returns the value of attribute position.



20
21
22
# File 'lib/manifestly/entity/checklist_step.rb', line 20

def position
  @position
end

#run_detailed_titleObject

Returns the value of attribute run_detailed_title.



17
18
19
# File 'lib/manifestly/entity/checklist_step.rb', line 17

def run_detailed_title
  @run_detailed_title
end

#run_idObject

Returns the value of attribute run_id.



21
22
23
# File 'lib/manifestly/entity/checklist_step.rb', line 21

def run_id
  @run_id
end

#run_step_data_settingObject

Returns the value of attribute run_step_data_setting.



27
28
29
# File 'lib/manifestly/entity/checklist_step.rb', line 27

def run_step_data_setting
  @run_step_data_setting
end

#skippedObject

Returns the value of attribute skipped.



22
23
24
# File 'lib/manifestly/entity/checklist_step.rb', line 22

def skipped
  @skipped
end

#titleObject

Returns the value of attribute title.



23
24
25
# File 'lib/manifestly/entity/checklist_step.rb', line 23

def title
  @title
end

#userObject

Returns the value of attribute user.



25
26
27
# File 'lib/manifestly/entity/checklist_step.rb', line 25

def user
  @user
end

#user_idObject

Returns the value of attribute user_id.



24
25
26
# File 'lib/manifestly/entity/checklist_step.rb', line 24

def user_id
  @user_id
end

Class Method Details

.list(run) ⇒ Object



56
57
58
59
60
# File 'lib/manifestly/entity/checklist_step.rb', line 56

def self.list(run)
  response = client.get("#{run.path}/#{run.id}/#{path}")
  json_entities = JSON.parse(response[:body], symbolize_names: true)[path.to_sym]
  json_entities.map { |it| new(run, it) }
end

.pathObject



52
53
54
# File 'lib/manifestly/entity/checklist_step.rb', line 52

def self.path
  'run_steps'
end

Instance Method Details

#add_comment(comment) ⇒ Object



98
99
100
101
102
# File 'lib/manifestly/entity/checklist_step.rb', line 98

def add_comment(comment)
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/comments", params: {comment: comment})
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#add_data(data) ⇒ Object



86
87
88
89
90
# File 'lib/manifestly/entity/checklist_step.rb', line 86

def add_data(data)
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/data", params: {data: data})
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#add_picture(base_64_encoded_picture_data) ⇒ Object



92
93
94
95
96
# File 'lib/manifestly/entity/checklist_step.rb', line 92

def add_picture(base_64_encoded_picture_data)
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/picture", params: {picture: base_64_encoded_picture_data})
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#assign(user_id) ⇒ Object



104
105
106
107
108
# File 'lib/manifestly/entity/checklist_step.rb', line 104

def assign(user_id)
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/assign", params: {assignee_user_id: user_id})
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#completeObject



62
63
64
65
66
# File 'lib/manifestly/entity/checklist_step.rb', line 62

def complete
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/complete")
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#skipObject



74
75
76
77
78
# File 'lib/manifestly/entity/checklist_step.rb', line 74

def skip
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/skip")
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#uncompleteObject



68
69
70
71
72
# File 'lib/manifestly/entity/checklist_step.rb', line 68

def uncomplete
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/uncomplete")
  @parent.instance_variable_set(:@steps, nil)
  nil
end

#unskipObject



80
81
82
83
84
# File 'lib/manifestly/entity/checklist_step.rb', line 80

def unskip
  client.post("#{@parent.path}/#{@parent.id}/#{path}/#{id}/unskip")
  @parent.instance_variable_set(:@steps, nil)
  nil
end