Class: TentClient::Follower

Inherits:
Object
  • Object
show all
Defined in:
lib/tent-client/follower.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Follower

Returns a new instance of Follower.



3
4
5
# File 'lib/tent-client/follower.rb', line 3

def initialize(client)
  @client = client
end

Instance Method Details

#challenge(path) ⇒ Object



31
32
33
34
35
# File 'lib/tent-client/follower.rb', line 31

def challenge(path)
  str = SecureRandom.hex(32)
  res = @client.http.get(path.sub(%r{\A/}, ''), :challenge => str)
  res.status == 200 && res.body.match(/\A#{str}/)
end

#count(params = {}) ⇒ Object



11
12
13
# File 'lib/tent-client/follower.rb', line 11

def count(params={})
  @client.http.get('followers/count', params)
end

#create(data) ⇒ Object



7
8
9
# File 'lib/tent-client/follower.rb', line 7

def create(data)
  @client.http.post 'followers', data
end

#delete(id) ⇒ Object



27
28
29
# File 'lib/tent-client/follower.rb', line 27

def delete(id)
  @client.http.delete "followers/#{id}"
end

#get(id) ⇒ Object



19
20
21
# File 'lib/tent-client/follower.rb', line 19

def get(id)
  @client.http.get "followers/#{id}"
end

#list(params = {}) ⇒ Object



15
16
17
# File 'lib/tent-client/follower.rb', line 15

def list(params = {})
  @client.http.get "followers", params
end

#update(id, data) ⇒ Object



23
24
25
# File 'lib/tent-client/follower.rb', line 23

def update(id, data)
  @client.http.put "followers/#{id}", data
end