Class: SpinCandidate

Inherits:
ApplicationRecord show all
Defined in:
app/models/spin_candidate.rb

Instance Method Summary collapse

Instance Method Details

#is_candidate?(user:) ⇒ Boolean


8
9
10
11
# File 'app/models/spin_candidate.rb', line 8

def is_candidate? user:
  client = Providers::BaseManager.new(user).get_connector
  client.candidate_spin? full_name
end

#publish_spin(user:) ⇒ Object


13
14
15
16
17
18
19
20
21
22
# File 'app/models/spin_candidate.rb', line 13

def publish_spin user:
  if spin.check user
    spin.visible = true
    if spin.save
      self.published = true
      return true if save
    end
  end
  false
end

#unpublishObject


24
25
26
27
28
29
30
31
# File 'app/models/spin_candidate.rb', line 24

def unpublish
  spin.visible = false
  if spin.save
    self.published = false
    return true if save
  end
  false
end