Class: Newsfeed::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/newsfeed/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_url) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
# File 'lib/newsfeed/client.rb', line 8

def initialize(api_url)
  @uri = api_url
  @conn = Newsfeed.setup_connection(api_url) do |faraday|
    faraday.use ClientResponseHandler
  end
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/newsfeed/client.rb', line 6

def uri
  @uri
end

Instance Method Details

#projects(codename = nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/newsfeed/client.rb', line 15

def projects(codename = nil)
  if codename.nil?
    list_projects
  else
    get_project(codename)
  end
end