shangrila 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8022c9fc7d0f2d97e8494a333b573eb0278cd74
4
- data.tar.gz: 9d1669b0224873de6e3cfd7c6d74383e8eb38c15
3
+ metadata.gz: 743586030befdeadefa543c1f2d90799e1658282
4
+ data.tar.gz: 6022cac914f2ca32da6b6850d667c5613227741a
5
5
  SHA512:
6
- metadata.gz: 2f8caad4de2e9e82bc9ddb16163b471889a067af773f96560b77dc7020b3e3a53a467e8aa5f0421952f2760c707c408986fc7ced9ff14c1bc3609cea431b7c48
7
- data.tar.gz: d69db0f8ba3202525a0cf453b501cf04f94bafabbc8e0c6f3082eb518f8b14a86b7301945092712b3ba776198902eb4a1e6301a84dc607b9382ddacb94c908fc
6
+ metadata.gz: 4bc527c867fb2806309dd8573323496ccf332ddd9aadc97a22d92164801657986dde8faea220845221a8616197ce77b33c989746bbf6a38d55c4ece3b6f66d6f
7
+ data.tar.gz: 14daac15063a0757e7df2791ceafd76aecaba2f62a0fa3c55383bee82c27755da3187c77c8bf3147a59370f2259b84005d04f36c78b5fcddb1bf2f8867335141
data/README.md CHANGED
@@ -8,7 +8,19 @@ or Gemfile
8
8
 
9
9
  ``gem 'shangrila'``
10
10
 
11
- ##Usage
11
+ ## anime-api command
12
+
13
+ ```
14
+ shell$ anime-api -h
15
+ Usage: anime-api [options]
16
+ -c COURS anime cours..1=winter or 2=spring or 3=summer or 4=autumn
17
+ -y YEAR year...2014 <= ?
18
+ -s connect standby_server. default=moemoe.tokyo standby=api.tv-anime.biz
19
+
20
+ shell$ anime-api -y 2016 -c 4 | jq .
21
+ ```
22
+
23
+ ## gem Usage
12
24
 
13
25
  ### Master API
14
26
 
data/bin/anime-api CHANGED
@@ -21,4 +21,8 @@ rescue => exc
21
21
  return
22
22
  end
23
23
 
24
- puts Shangrila::Sora.new().get_master_data_raw(year, cours)
24
+ hostname = nil
25
+
26
+ hostname = 'api.tv-anime.biz' if standby_server
27
+
28
+ puts Shangrila::Sora.new(hostname).get_master_data_raw(year, cours)
@@ -8,7 +8,8 @@ module Shangrila
8
8
  class Sana
9
9
  URL = 'http://api.moemoe.tokyo/anime/v1/twitter'
10
10
 
11
- def initialize
11
+ def initialize(hostname = 'api.moemoe.tokyo')
12
+ @url = "http://#{hostname}/anime/v1/master"
12
13
  end
13
14
 
14
15
  # @param [Array] accounts データ取得対象のアニメTwitter公式アカウント
@@ -6,16 +6,16 @@ require 'httpclient'
6
6
  module Shangrila
7
7
 
8
8
  class Sora
9
- URL = 'http://api.moemoe.tokyo/anime/v1/master'
10
9
 
11
- def initialize
10
+ def initialize(hostname = 'api.moemoe.tokyo')
11
+ @url = "http://#{hostname}/anime/v1/master"
12
12
  end
13
13
 
14
14
  # @param [Int] year データ取得対象のアニメの年
15
15
  # @param [Int] cours データ取得対象のアニメの年のクール番号 1-4
16
16
  # @return [JSON] アニメのマスターデータすべて
17
17
  def get_master_data_raw(year, cours)
18
- response = HTTPClient.get(sprintf("%s/%s/%s", URL, year, cours))
18
+ response = HTTPClient.get(sprintf("%s/%s/%s", @url, year, cours))
19
19
  response.body
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ module Shangrila
23
23
  # @param [Int] cours データ取得対象のアニメの年のクール番号 1-4
24
24
  # @return [JSON->RubyHash] アニメのマスターデータすべて
25
25
  def get_master_data(year, cours)
26
- response = HTTPClient.get(sprintf("%s/%s/%s", URL, year, cours))
26
+ response = HTTPClient.get(sprintf("%s/%s/%s", @url, year, cours))
27
27
  JSON.load(response.body)
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module Shangrila
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
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.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AKB428