Class: Yapt::Move

Inherits:
Object
  • Object
show all
Defined in:
lib/yapt/move.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(to_move, target) ⇒ Move

Returns a new instance of Move.



10
11
12
# File 'lib/yapt/move.rb', line 10

def initialize(to_move, target)
  @to_move, @target = to_move, target
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



9
10
11
# File 'lib/yapt/move.rb', line 9

def target
  @target
end

#to_moveObject (readonly)

Returns the value of attribute to_move.



9
10
11
# File 'lib/yapt/move.rb', line 9

def to_move
  @to_move
end

Class Method Details

.setup(id, target_id) ⇒ Object



3
4
5
6
7
# File 'lib/yapt/move.rb', line 3

def self.setup(id, target_id)
  to_move = Story.find(id)
  target = Story.find(target_id)
  new(to_move, target)
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/yapt/move.rb', line 14

def description
  "Move #{to_move.id} just above #{target.id}"
end

#execute!Object



24
25
26
# File 'lib/yapt/move.rb', line 24

def execute!
  Request.new("stories/#{to_move.id}", params, :put).result
end

#paramsObject



18
19
20
21
22
# File 'lib/yapt/move.rb', line 18

def params
  {
    before_id: target.id
  }
end