Class: Shangrila::Sana
- Inherits:
-
Object
- Object
- Shangrila::Sana
- Defined in:
- lib/shangrila/sana.rb
Instance Method Summary collapse
-
#follower_history(account, end_date = nil) ⇒ Array
フォロワー数と更新日時のハッシュの配列.
-
#follower_history_daily(account, days = nil) ⇒ Array
/anime/v1/twitter/follower/history/daily.
-
#follower_status(accounts, is_to_json = true) ⇒ Hash
アカウント群をキーとしたハッシュ.
-
#initialize(hostname = 'api.moemoe.tokyo') ⇒ Sana
constructor
A new instance of Sana.
Constructor Details
#initialize(hostname = 'api.moemoe.tokyo') ⇒ Sana
Returns a new instance of Sana.
10 11 12 |
# File 'lib/shangrila/sana.rb', line 10 def initialize(hostname = 'api.moemoe.tokyo') @url = "http://#{hostname}/anime/v1/twitter" end |
Instance Method Details
#follower_history(account, end_date = nil) ⇒ Array
Returns フォロワー数と更新日時のハッシュの配列.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/shangrila/sana.rb', line 25 def follower_history(account, end_date = nil) response = nil if end_date.nil? response = HTTPClient.get(sprintf('%s/follower/history?account=%s', @url, account)) else response = HTTPClient.get(sprintf('%s/follower/history?account=%s&end_date=%d', @url, account, end_date)) end JSON.load(response.body) end |
#follower_history_daily(account, days = nil) ⇒ Array
/anime/v1/twitter/follower/history/daily
40 41 42 43 44 |
# File 'lib/shangrila/sana.rb', line 40 def follower_history_daily(account, days = nil) response = HTTPClient.get(sprintf('%s/follower/history/daily?account=%s&days=%s', @url, account, days)) JSON.load(response.body) end |
#follower_status(accounts, is_to_json = true) ⇒ Hash
Returns アカウント群をキーとしたハッシュ.
17 18 19 20 |
# File 'lib/shangrila/sana.rb', line 17 def follower_status(accounts, is_to_json = true) response = HTTPClient.get(sprintf('%s/follower/status?accounts=%s', @url, accounts.join(','))) is_to_json ? JSON.load(response.body) : response.body end |