shangrila 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/bin/anime-api +7 -3
- data/bin/anime-api-twitter +23 -0
- data/lib/shangrila/sana.rb +8 -8
- data/lib/shangrila/version.rb +1 -1
- data/shangrila-sdk-ruby.gemspec +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c332f0599b50810652f93716c4f5e2582ce4906d
|
4
|
+
data.tar.gz: c24bc942b63376af2b64281ed59bb1186fea7c53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1aeff5adb86b8d23b922f66f96e06099f0f9a5c6842994bd28f252da867fc0b67a9169859eb5bff82805f597d571c7cdb429b6d52563f4448a4ebe6e188f8a
|
7
|
+
data.tar.gz: 2da03cd8cf0f6820de9b862e719b5df21ea7939c3e1c0b1cf298a7e9ffdc7854792991643e2a5c0f861952335372f6b441154b9df9d22b894813bad8f92a78f4
|
data/README.md
CHANGED
@@ -8,7 +8,9 @@ or Gemfile
|
|
8
8
|
|
9
9
|
``gem 'shangrila'``
|
10
10
|
|
11
|
-
##
|
11
|
+
## Command Usage
|
12
|
+
|
13
|
+
### anime-api
|
12
14
|
|
13
15
|
```
|
14
16
|
shell$ anime-api -h
|
@@ -20,7 +22,14 @@ Usage: anime-api [options]
|
|
20
22
|
shell$ anime-api -y 2016 -c 4 | jq .
|
21
23
|
```
|
22
24
|
|
23
|
-
|
25
|
+
### anime-api-twitter
|
26
|
+
|
27
|
+
```
|
28
|
+
shell$ anime-api-twitter -a usagi_anime
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
## Gem Usage
|
24
33
|
|
25
34
|
### Master API
|
26
35
|
|
data/bin/anime-api
CHANGED
@@ -21,8 +21,12 @@ rescue => exc
|
|
21
21
|
return
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
anime_master = nil
|
25
25
|
|
26
|
-
|
26
|
+
if standby_server
|
27
|
+
anime_master = Shangrila::Sora.new('api.tv-anime.biz')
|
28
|
+
else
|
29
|
+
anime_master = Shangrila::Sora.new()
|
30
|
+
end
|
27
31
|
|
28
|
-
puts
|
32
|
+
puts anime_master.get_master_data_raw(year, cours)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'shangrila'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
opt = OptionParser.new
|
6
|
+
|
7
|
+
account = ''
|
8
|
+
|
9
|
+
Version = '1.0.0'
|
10
|
+
|
11
|
+
opt.on('-a twitter_account', 'twitter account name') {|v| account = v}
|
12
|
+
|
13
|
+
begin
|
14
|
+
opt.parse!(ARGV)
|
15
|
+
rescue => exc
|
16
|
+
p exc
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
#TODO sanaは待機系サーバーがない
|
21
|
+
|
22
|
+
api = Shangrila::Sana.new()
|
23
|
+
puts api.follower_history(account, false)
|
data/lib/shangrila/sana.rb
CHANGED
@@ -6,17 +6,17 @@ require 'httpclient'
|
|
6
6
|
module Shangrila
|
7
7
|
|
8
8
|
class Sana
|
9
|
-
URL = 'http://api.moemoe.tokyo/anime/v1/twitter'
|
10
9
|
|
11
10
|
def initialize(hostname = 'api.moemoe.tokyo')
|
12
|
-
@url = "http://#{hostname}/anime/v1/
|
11
|
+
@url = "http://#{hostname}/anime/v1/twitter"
|
13
12
|
end
|
14
13
|
|
15
14
|
# @param [Array] accounts データ取得対象のアニメTwitter公式アカウント
|
15
|
+
# @param [boolean] is_to_json JSONをRubyHashにして返すかどうか
|
16
16
|
# @return [Hash] アカウント群をキーとしたハッシュ
|
17
|
-
def follower_status(accounts)
|
18
|
-
response = HTTPClient.get(sprintf('%s/follower/status?accounts=%s',
|
19
|
-
JSON.load(response.body)
|
17
|
+
def follower_status(accounts, is_to_json = true)
|
18
|
+
response = HTTPClient.get(sprintf('%s/follower/status?accounts=%s', @url, accounts.join(',')))
|
19
|
+
is_to_json ? JSON.load(response.body) : response.body
|
20
20
|
end
|
21
21
|
|
22
22
|
# @param [String] account データ取得対象のアニメTwitter公式アカウント
|
@@ -25,9 +25,9 @@ module Shangrila
|
|
25
25
|
def follower_history(account, end_date = nil)
|
26
26
|
response = nil
|
27
27
|
if end_date.nil?
|
28
|
-
response = HTTPClient.get(sprintf('%s/follower/history?account=%s',
|
28
|
+
response = HTTPClient.get(sprintf('%s/follower/history?account=%s', @url, account))
|
29
29
|
else
|
30
|
-
response = HTTPClient.get(sprintf('%s/follower/history?account=%s&end_date=%d',
|
30
|
+
response = HTTPClient.get(sprintf('%s/follower/history?account=%s&end_date=%d', @url, account, end_date))
|
31
31
|
end
|
32
32
|
|
33
33
|
JSON.load(response.body)
|
@@ -38,7 +38,7 @@ module Shangrila
|
|
38
38
|
# @param [int] days 取得日数
|
39
39
|
# @return [Array] フォロワー数と更新日時のハッシュの配列
|
40
40
|
def follower_history_daily(account, days = nil)
|
41
|
-
response = HTTPClient.get(sprintf('%s/follower/history/daily?account=%s&days=%s',
|
41
|
+
response = HTTPClient.get(sprintf('%s/follower/history/daily?account=%s&days=%s', @url, account, days))
|
42
42
|
|
43
43
|
JSON.load(response.body)
|
44
44
|
end
|
data/lib/shangrila/version.rb
CHANGED
data/shangrila-sdk-ruby.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shangrila
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AKB428
|
@@ -57,6 +57,7 @@ email:
|
|
57
57
|
- gandara016+1@gmail.com
|
58
58
|
executables:
|
59
59
|
- anime-api
|
60
|
+
- anime-api-twitter
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
68
69
|
- bin/anime-api
|
70
|
+
- bin/anime-api-twitter
|
69
71
|
- lib/shangrila.rb
|
70
72
|
- lib/shangrila/sana.rb
|
71
73
|
- lib/shangrila/sora.rb
|