Class: DesignerNews::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Comments, Motds, Stories, Users, Configurable, Connection
Defined in:
lib/designer_news/client.rb,
lib/designer_news/client/motds.rb,
lib/designer_news/client/users.rb,
lib/designer_news/client/stories.rb,
lib/designer_news/client/comments.rb

Defined Under Namespace

Modules: Comments, Motds, Stories, Users

Instance Attribute Summary

Attributes included from Configurable

#access_token, #api_endpoint, #middleware, #user_agent

Instance Method Summary collapse

Methods included from Motds

#downvote_motd, #motd, #upvote_motd

Methods included from Comments

#comment, #reply_to_comment, #upvote_comment

Methods included from Stories

#recent_stories, #reply_to_story, #search_stories, #stories, #story, #upvote_story

Methods included from Users

#me

Methods included from Connection

#connection, #request

Methods included from Configurable

#configure, keys, #reset!

Methods included from Authentication

#token_authenticated?

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



33
34
35
36
37
# File 'lib/designer_news/client.rb', line 33

def initialize(options={})
  DesignerNews::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || DesignerNews.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#delete(url, options = {}) ⇒ Object



51
52
53
# File 'lib/designer_news/client.rb', line 51

def delete(url, options = {})
  request :delete, url, options
end

#get(url, options = {}) ⇒ Object



39
40
41
# File 'lib/designer_news/client.rb', line 39

def get(url, options = {})
  request :get, url, options
end

#post(url, options = {}) ⇒ Object



43
44
45
# File 'lib/designer_news/client.rb', line 43

def post(url, options = {})
  request :post, url, options
end

#put(url, options = {}) ⇒ Object



47
48
49
# File 'lib/designer_news/client.rb', line 47

def put(url, options = {})
  request :put, url, options
end