Class: Yo::HTTP
- Inherits:
-
Object
- Object
- Yo::HTTP
- Defined in:
- lib/yo4r/http.rb
Instance Method Summary collapse
-
#initialize(api_token: nil) ⇒ HTTP
constructor
A new instance of HTTP.
- #subscribers_count ⇒ Object
- #yo(username: nil) ⇒ Object
- #yoall ⇒ Object
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_count ⇒ Object
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 |
#yoall ⇒ Object
15 16 17 |
# File 'lib/yo4r/http.rb', line 15 def yoall access_api { @faraday.post('/yoall/', api_token: @api_token) } end |