Class: ContributionCount::Client
- Inherits:
-
Object
- Object
- ContributionCount::Client
show all
- Defined in:
- lib/contribution_count/client.rb
Defined Under Namespace
Classes: NoAccountError, NoDataError
Constant Summary
collapse
- URL =
"https://github.com/users/"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(account_name) ⇒ Client
Returns a new instance of Client.
8
9
10
|
# File 'lib/contribution_count/client.rb', line 8
def initialize(account_name)
@url = URL + account_name + "/contributions"
end
|
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
6
7
8
|
# File 'lib/contribution_count/client.rb', line 6
def url
@url
end
|
Instance Method Details
#all ⇒ Object
22
23
24
|
# File 'lib/contribution_count/client.rb', line 22
def all
count_hash
end
|
#date(date) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/contribution_count/client.rb', line 26
def date(date)
return if date.nil?
count = count_hash[date]
raise NoDataError if count.nil?
count
end
|
#today ⇒ Object
12
13
14
15
|
# File 'lib/contribution_count/client.rb', line 12
def today
today = Date.today.to_s
count_hash[today]
end
|
#yesterday ⇒ Object
17
18
19
20
|
# File 'lib/contribution_count/client.rb', line 17
def yesterday
yesterday = (Date.today - 1).to_s
count_hash[yesterday]
end
|