Class: BlockScore::Candidates

Inherits:
Object
  • Object
show all
Defined in:
lib/blockscore/candidates.rb

Constant Summary collapse

PATH =
'/candidates'

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Candidates

Returns a new instance of Candidates.



5
6
7
# File 'lib/blockscore/candidates.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#all(count = nil, offset = nil, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/blockscore/candidates.rb', line 30

def all(count = nil, offset = nil, options = {})
  body = (options.include? :body) ? options[:body] : {}

  body[:count] = count
  body[:offset] = offset

  @client.get PATH, body
end

#create(options = {}) ⇒ Object



10
11
12
# File 'lib/blockscore/candidates.rb', line 10

def create(options = {})
  response = @client.post PATH, options
end

#delete(candidate_id) ⇒ Object

DELETE api.blockscore.com/candidates/CANDIDATE_ID



20
21
22
# File 'lib/blockscore/candidates.rb', line 20

def delete(candidate_id)
  response = @client.delete "#{PATH}/#{candidate_id}"
end

#edit(candidate_id, options = {}) ⇒ Object

PATCH api.blockscore.com/candidates/CANDIDATE_ID



15
16
17
# File 'lib/blockscore/candidates.rb', line 15

def edit(candidate_id, options = {})
  response = @client.put "#{PATH}/#{candidate_id}", options 
end

#history(candidate_id) ⇒ Object



40
41
42
# File 'lib/blockscore/candidates.rb', line 40

def history(candidate_id)
  response = @client.get "#{PATH}/#{candidate_id}/history"
end

#hits(candidate_id) ⇒ Object



45
46
47
# File 'lib/blockscore/candidates.rb', line 45

def hits(candidate_id)
  response = @client.get "#{PATH}/#{candidate_id}/hits"
end

#retrieve(candidate_id) ⇒ Object



25
26
27
# File 'lib/blockscore/candidates.rb', line 25

def retrieve(candidate_id)
  response = @client.get "#{PATH}/#{candidate_id}"
end