Class: Yo::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/yo4r/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_token: nil) ⇒ HTTP

Returns a new instance of HTTP.



6
7
8
9
# File 'lib/yo4r/http.rb', line 6

def initialize(api_token: nil)
  @api_token = api_token
  @faraday   = Faraday.new('http://api.justyo.co')
end

Instance Method Details

#subscribers_countObject



19
20
21
# File 'lib/yo4r/http.rb', line 19

def subscribers_count
  access_api { @faraday.get('/subscribers_count/', api_token: @api_token) }
end

#yo(username: nil) ⇒ Object



11
12
13
# File 'lib/yo4r/http.rb', line 11

def yo(username: nil)
  return true if access_api { @faraday.post('/yo/', api_token: @api_token, username: username) }
end

#yoallObject



15
16
17
# File 'lib/yo4r/http.rb', line 15

def yoall
  access_api { @faraday.post('/yoall/', api_token: @api_token) }
end