Class: Ulule::Client
- Inherits:
-
Object
- Object
- Ulule::Client
- Defined in:
- lib/ulule/client.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #me ⇒ Object
- #my_projects(options = {}) ⇒ Object
- #news(id) ⇒ Object
- #news_comments(id, options = {}) ⇒ Object
- #project(slug) ⇒ Object
- #project_comments(slug, options = {}) ⇒ Object
- #project_news(slug) ⇒ Object
- #projects(user, options = {}) ⇒ Object
- #supporters(slug) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ulule/client.rb', line 7 def initialize( = {}) @key = .fetch(:key) { ENV.fetch('ULULE_API_KEY') } @username = .fetch(:username) { ENV.fetch('ULULE_USERNAME') } @host = .fetch(:host) { 'https://api.ulule.com/v1/' } @projects = 'projects' @comments = 'comments' @supporters = 'supporters' @news = 'news' @users = 'users' end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/ulule/client.rb', line 5 def key @key end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/ulule/client.rb', line 5 def username @username end |
Instance Method Details
#me ⇒ Object
20 21 22 |
# File 'lib/ulule/client.rb', line 20 def me get("#{@users}/#{@username}") end |
#my_projects(options = {}) ⇒ Object
24 25 26 |
# File 'lib/ulule/client.rb', line 24 def my_projects( = {}) get("#{@users}/#{@username}/#{@projects}", ) end |
#news(id) ⇒ Object
44 45 46 |
# File 'lib/ulule/client.rb', line 44 def news id get("#{@news}/#{id}") end |
#news_comments(id, options = {}) ⇒ Object
48 49 50 |
# File 'lib/ulule/client.rb', line 48 def news_comments(id, = {}) get("#{@news}/#{id}/#{@comments}", ) end |
#project(slug) ⇒ Object
32 33 34 |
# File 'lib/ulule/client.rb', line 32 def project slug get("#{@projects}/#{slug}") end |
#project_comments(slug, options = {}) ⇒ Object
36 37 38 |
# File 'lib/ulule/client.rb', line 36 def project_comments(slug, = {}) get("#{@projects}/#{slug}/#{@comments}", ) end |
#project_news(slug) ⇒ Object
40 41 42 |
# File 'lib/ulule/client.rb', line 40 def project_news slug get("#{@projects}/#{slug}/#{@news}") end |
#projects(user, options = {}) ⇒ Object
28 29 30 |
# File 'lib/ulule/client.rb', line 28 def projects(user, = {}) get("#{@users}/#{user}/#{@projects}", ) end |
#supporters(slug) ⇒ Object
52 53 54 |
# File 'lib/ulule/client.rb', line 52 def supporters slug get ("#{@projects}/#{slug}/#{@supporters}") end |