fanart_api 0.1.3 → 0.2.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: e3c9235e81d94821a9f7f27f9455a22243e1c3f5
4
- data.tar.gz: e8f9ba9d699c790fdcf5e8d212e8bd7a666e54dd
3
+ metadata.gz: e7ecce6bacc1e88ad3e5335d7cbd182bf5f35fc0
4
+ data.tar.gz: 2e3cfd6d336439d53321b81e73b95d5b51d41cf6
5
5
  SHA512:
6
- metadata.gz: 0bc10d02052fe40cccb6bc92bd6559d1da177e4629c49db9812e486c9cd437f257edcb279e7a86a2660a24785d6b878da33bdc6432724275e7493e1b56647a58
7
- data.tar.gz: a3a5c54fcaa45a354245b31e3da6c0b57c9d842b4cabff371f71a2b11a7a1aa6de13789a6ba8a327ae1c2e58202d5deac0e28958f66003e0ce74609f459d829a
6
+ metadata.gz: bf79440ee6a3337dd83f3be9ddf5e38dba652436c04edb2b39e540f574dc8ddd3df12be91a706f151bb90acd01a702f17c82bcab136dac228e1b71e8df84712c
7
+ data.tar.gz: 56d5f6a8c66b23b0f3a15c17598d01c19274ada77b7ce06d93f25db080c195c9d1b8db07ae87a6265aca197dabec6811a5eff98c2d2f027bf61ecd1d036ffd5b
data/README.md CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  Ruby client for fanart.tv API
10
10
 
11
+ fanart.tv APIv2 - FanartApi gem v0.1.x (lastest v0.1.3)
12
+ fanart.tv APIv3 - FanartApi gem v0.2.x (from v0.2.0)
13
+
11
14
  ## Getting started
12
15
 
13
16
  You can add it to your Gemfile with:
@@ -24,29 +27,35 @@ There is one entry point, in initialize you can past hash with api_key value, or
24
27
  client = FanartApi::Client.new(api_key: 'API_KEY')
25
28
  ```
26
29
 
30
+ Optional you can add option proxy: false which will not send request to proxy.
31
+
32
+ ```ruby
33
+ client = FanartApi::Client.new(api_key: 'API_KEY', proxy: false)
34
+ ```
35
+
27
36
  ## Usage
28
37
 
29
38
  Movie API
30
39
 
31
40
  ```ruby
32
- client.movie.find(id: id, type: 'all', sort: '1', limit: '2')
33
- client.movie.update(timestamp: 1...)
41
+ client.movie.find(id: id)
42
+ client.movie.latest(date: 1...)
34
43
  ```
35
44
 
36
45
  Music API
37
46
 
38
47
  ```ruby
39
- client.music.artist(id: id, type: 'all', sort: '1', limit: '2')
40
- client.music.album(id: id, type: 'all', sort: '1', limit: '2')
41
- client.music.label(id: id, type: 'all', sort: '1', limit: '2')
42
- client.music.update(timestamp: 1...)
48
+ client.music.artist(id: id)
49
+ client.music.album(id: id)
50
+ client.music.label(id: id)
51
+ client.music.latest(date: 1...)
43
52
  ```
44
53
 
45
54
  Tv API
46
55
 
47
56
  ```ruby
48
- client.tv.find(id: id, type: 'all', sort: '1', limit: '2')
49
- client.tv.update(timestamp: 1...)
57
+ client.tv.find(id: id)
58
+ client.tv.latest(date: 1...)
50
59
  ```
51
60
 
52
61
  ## Contributing
@@ -12,19 +12,11 @@ class FanartApi::Base
12
12
  end
13
13
 
14
14
  def find_path
15
- ':kind/:api_key/:id/json/:type/:sort/:limit'
15
+ ':kind/:id'
16
16
  end
17
17
 
18
- def update_path
19
- ':kind/:api_key/:timestamp'
20
- end
21
-
22
- def default_options
23
- {
24
- type: 'all',
25
- sort: 1,
26
- limit: 2
27
- }
18
+ def latest_path
19
+ ':kind/latest'
28
20
  end
29
21
 
30
22
  private
@@ -34,10 +26,10 @@ class FanartApi::Base
34
26
  end
35
27
 
36
28
  def base_url
37
- 'http://api.fanart.tv/webservice/'
29
+ if @client.options[:proxy] == false
30
+ 'http://webservice.fanart.tv/v3/'
31
+ else
32
+ 'http://fanarttv.apiary-proxy.com/v3/'
33
+ end
38
34
  end
39
-
40
- # def shared_uri
41
- # '{api_key}/{id}/json/{type}/{sort}/{limit}'
42
- # end
43
35
  end
@@ -8,21 +8,21 @@ class FanartApi::Movie < FanartApi::Base
8
8
  find_path_with_params(options).url
9
9
  end
10
10
 
11
- def update(options = {})
12
- update_path_with_params(options).get
11
+ def latest(options = {})
12
+ latest_path_with_params(options).get
13
13
  end
14
14
 
15
- def update_url(options = {})
16
- update_path_with_params(options).url
15
+ def latest_url(options = {})
16
+ latest_path_with_params(options).url
17
17
  end
18
18
 
19
19
  private
20
20
 
21
21
  def find_path_with_params(options)
22
- path_with_params(find_path, default_options.merge(options.merge(kind: :movie)))
22
+ path_with_params(find_path, options.merge(kind: :movies))
23
23
  end
24
24
 
25
- def update_path_with_params(options)
26
- path_with_params(update_path, options.merge(kind: :newmovies))
25
+ def latest_path_with_params(options)
26
+ path_with_params(latest_path, options.merge(kind: :movies))
27
27
  end
28
28
  end
@@ -24,29 +24,37 @@ class FanartApi::Music < FanartApi::Base
24
24
  label_path_with_params(options).url
25
25
  end
26
26
 
27
- def update(options = {})
28
- update_path_with_params(options).get
27
+ def latest(options = {})
28
+ latest_path_with_params(options).get
29
29
  end
30
30
 
31
- def update_url(options = {})
32
- update_path_with_params(options).url
31
+ def latest_url(options = {})
32
+ latest_path_with_params(options).url
33
33
  end
34
34
 
35
35
  private
36
36
 
37
37
  def artist_path_with_params(options)
38
- path_with_params(find_path, default_options.merge(options.merge(kind: :artist)))
38
+ path_with_params(find_path, options.merge(kind: :music))
39
39
  end
40
40
 
41
41
  def album_path_with_params(options)
42
- path_with_params(find_path, default_options.merge(options.merge(kind: :album)))
42
+ path_with_params(album_path, options.merge(kind: :music))
43
43
  end
44
44
 
45
45
  def label_path_with_params(options)
46
- path_with_params(find_path, default_options.merge(options.merge(kind: :label)))
46
+ path_with_params(label_path, options.merge(kind: :music))
47
47
  end
48
48
 
49
- def update_path_with_params(options)
50
- path_with_params(update_path, options.merge(kind: :newmusic))
49
+ def latest_path_with_params(options)
50
+ path_with_params(latest_path, options.merge(kind: :music))
51
+ end
52
+
53
+ def album_path
54
+ ':kind/albums/:id'
55
+ end
56
+
57
+ def label_path
58
+ ':kind/labels/:id'
51
59
  end
52
60
  end
@@ -8,21 +8,21 @@ class FanartApi::Tv < FanartApi::Base
8
8
  find_path_with_params(options).url
9
9
  end
10
10
 
11
- def update(options = {})
12
- update_path_with_params(options).get
11
+ def latest(options = {})
12
+ latest_path_with_params(options).get
13
13
  end
14
14
 
15
- def update_url(options = {})
16
- update_path_with_params(options).url
15
+ def latest_url(options = {})
16
+ latest_path_with_params(options).url
17
17
  end
18
18
 
19
19
  private
20
20
 
21
21
  def find_path_with_params(options)
22
- path_with_params(find_path, default_options.merge(options.merge(kind: :series)))
22
+ path_with_params(find_path, options.merge(kind: :tv))
23
23
  end
24
24
 
25
- def update_path_with_params(options)
26
- path_with_params(update_path, options.merge(kind: :newtv))
25
+ def latest_path_with_params(options)
26
+ path_with_params(latest_path, options.merge(kind: :tv))
27
27
  end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module FanartApi
2
- VERSION = '0.1.3'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -1,39 +1,70 @@
1
1
  {
2
- "Evanescence": {
3
- "mbid_id": "f4a31f0a-51dd-4fa7-986d-3095c40c5ed9",
4
- "artistbackground": [
5
- {
6
- "id": "9",
7
- "url": "http://fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/artistbackground/9/evanescence-4dc719c5cc68f.jpg",
8
- "likes": "1"
9
- }
10
- ],
11
- "musiclogo": [
12
- {
13
- "id": "5239",
14
- "url": "http://fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/musiclogo/5239/evanescence-4df6263dee3c6.png",
15
- "likes": "1"
16
- }
17
- ],
18
- "albums": {
19
- "2187d248-1a3b-35d0-a4ec-bead586ff547": {
20
- "albumcover": [
21
- {
22
- "id": "43",
23
- "url": "http://fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/albumcover/43/fallen-4dc8683fa58fe.jpg",
24
- "likes": "0"
25
- }
26
- ],
27
- "cdart": [
28
- {
29
- "id": "17739",
30
- "url": "http://fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/cdart/17739/fallen-4f133f8a16d25.png",
31
- "likes": "0",
32
- "disc": "1",
33
- "size": "1000"
34
- }
35
- ]
36
- }
2
+ "name": "Evanescence",
3
+ "mbid_id": "f4a31f0a-51dd-4fa7-986d-3095c40c5ed9",
4
+ "artistbackground": [
5
+ {
6
+ "id": "130063",
7
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/artistbackground/evanescence-53c3e2009deda.jpg",
8
+ "likes": "0"
37
9
  }
38
- }
10
+ ],
11
+ "artistthumb": [
12
+ {
13
+ "id": "130067",
14
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/artistthumb/evanescence-53c3e236e646b.jpg",
15
+ "likes": "0"
16
+ }
17
+ ],
18
+ "musiclogo": [
19
+ {
20
+ "id": "27702",
21
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/musiclogo/evanescence-4f8acb2ae6002.png",
22
+ "likes": "1"
23
+ }
24
+ ],
25
+ "hdmusiclogo": [
26
+ {
27
+ "id": "127055",
28
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/hdmusiclogo/evanescence-539db9a415d69.png",
29
+ "likes": "1"
30
+ }
31
+ ],
32
+ "albums": {
33
+ "2187d248-1a3b-35d0-a4ec-bead586ff547": {
34
+ "albumcover": [
35
+ {
36
+ "id": "43",
37
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/albumcover/fallen-4dc8683fa58fe.jpg",
38
+ "likes": "1"
39
+ }
40
+ ],
41
+ "cdart": [
42
+ {
43
+ "id": "17739",
44
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/cdart/fallen-4f133f8a16d25.png",
45
+ "likes": "0",
46
+ "disc": "1",
47
+ "size": "1000"
48
+ }
49
+ ]
50
+ },
51
+ "ac7dd865-3c32-3bb9-9241-a4c63d940f67": {
52
+ "cdart": [
53
+ {
54
+ "id": "1874",
55
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/cdart/le-nouveau-gothique-4dd43ab8d1af6.png",
56
+ "likes": "0",
57
+ "disc": "1",
58
+ "size": "450"
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ "musicbanner": [
64
+ {
65
+ "id": "56733",
66
+ "url": "http://assets.fanart.tv/fanart/music/f4a31f0a-51dd-4fa7-986d-3095c40c5ed9/musicbanner/evanescence-507beae754bf6.jpg",
67
+ "likes": "1"
68
+ }
69
+ ]
39
70
  }
@@ -1,32 +1,79 @@
1
1
  {
2
- "The Lord of the Rings: The Fellowship of the Ring": {
3
- "tmdb_id": "120",
4
- "imdb_id": "tt0120737",
5
- "moviedisc": [
6
- {
7
- "id": "101",
8
- "url": "http://fanart.tv/fanart/movies/120/moviedisc/101/the-lord-of-the-rings-the-fellowship-of-the-ring-4eea008189187.png",
9
- "lang": "en",
10
- "likes": "0",
11
- "disc": "1",
12
- "disc_type": "bluray"
13
- },
14
- {
15
- "id": "102",
16
- "url": "http://fanart.tv/fanart/movies/120/moviedisc/102/the-lord-of-the-rings-the-fellowship-of-the-ring-4eea017193bf6.png",
17
- "lang": "en",
18
- "likes": "0",
19
- "disc": "2",
20
- "disc_type": "bluray"
21
- }
22
- ],
23
- "movielogo": [
24
- {
25
- "id": "222",
26
- "url": "http://fanart.tv/fanart/movies/120/movielogo/222/the-lord-of-the-rings-the-fellowship-of-the-ring-4ef23158be031.png",
27
- "lang": "en",
28
- "likes": "0"
29
- }
30
- ]
31
- }
32
- }
2
+ "name": "The Lord of the Rings: The Fellowship of the Ring",
3
+ "tmdb_id": "120",
4
+ "imdb_id": "tt0120737",
5
+ "hdmovielogo": [
6
+ {
7
+ "id": "35686",
8
+ "url": "http://assets.fanart.tv/fanart/movies/120/hdmovielogo/the-lord-of-the-rings-the-fellowship-of-the-ring-5199eb99bb348.png",
9
+ "lang": "hu",
10
+ "likes": "0"
11
+ }
12
+ ],
13
+ "moviedisc": [
14
+ {
15
+ "id": "15982",
16
+ "url": "http://assets.fanart.tv/fanart/movies/120/moviedisc/the-lord-of-the-rings-the-fellowship-of-the-ring-5072d26f68e75.png",
17
+ "lang": "fr",
18
+ "likes": "0",
19
+ "disc": "1",
20
+ "disc_type": "bluray"
21
+ }
22
+ ],
23
+ "movielogo": [
24
+ {
25
+ "id": "10233",
26
+ "url": "http://assets.fanart.tv/fanart/movies/120/movielogo/the-lord-of-the-rings-the-fellowship-of-the-ring-50366fc502e6d.png",
27
+ "lang": "fr",
28
+ "likes": "0"
29
+ }
30
+ ],
31
+ "movieposter": [
32
+ {
33
+ "id": "60802",
34
+ "url": "http://assets.fanart.tv/fanart/movies/120/movieposter/the-lord-of-the-rings-the-fellowship-of-the-ring-52ca39328f269.jpg",
35
+ "lang": "en",
36
+ "likes": "0"
37
+ }
38
+ ],
39
+ "hdmovieclearart": [
40
+ {
41
+ "id": "46178",
42
+ "url": "http://assets.fanart.tv/fanart/movies/120/hdmovieclearart/the-lord-of-the-rings-the-fellowship-of-the-ring-520e7bd8dd3b5.png",
43
+ "lang": "de",
44
+ "likes": "1"
45
+ }
46
+ ],
47
+ "movieart": [
48
+ {
49
+ "id": "1498",
50
+ "url": "http://assets.fanart.tv/fanart/movies/120/movieart/the-lord-of-the-rings-the-fellowship-of-the-ring-4f76f4dac9063.png",
51
+ "lang": "de",
52
+ "likes": "1"
53
+ }
54
+ ],
55
+ "moviebackground": [
56
+ {
57
+ "id": "5300",
58
+ "url": "http://assets.fanart.tv/fanart/movies/120/moviebackground/the-lord-of-the-rings-the-fellowship-of-the-ring-4fdb8b38d794e.jpg",
59
+ "lang": "en",
60
+ "likes": "1"
61
+ }
62
+ ],
63
+ "moviebanner": [
64
+ {
65
+ "id": "46179",
66
+ "url": "http://assets.fanart.tv/fanart/movies/120/moviebanner/the-lord-of-the-rings-the-fellowship-of-the-ring-520e7bf6818ef.jpg",
67
+ "lang": "de",
68
+ "likes": "0"
69
+ }
70
+ ],
71
+ "moviethumb": [
72
+ {
73
+ "id": "68153",
74
+ "url": "http://assets.fanart.tv/fanart/movies/120/moviethumb/the-lord-of-the-rings-the-fellowship-of-the-ring-532efd41bf3ae.jpg",
75
+ "lang": "en",
76
+ "likes": "0"
77
+ }
78
+ ]
79
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "Bones",
3
+ "thetvdb_id": "75682",
4
+ "clearlogo": [
5
+ {
6
+ "id": "13571",
7
+ "url": "http://assets.fanart.tv/fanart/tv/75682/clearlogo/bones-4e764b27c454d.png",
8
+ "lang": "ar",
9
+ "likes": "1"
10
+ }
11
+ ],
12
+ "hdtvlogo": [
13
+ {
14
+ "id": "37201",
15
+ "url": "http://assets.fanart.tv/fanart/tv/75682/hdtvlogo/bones-530b4bb8bfaf7.png",
16
+ "lang": "he",
17
+ "likes": "1"
18
+ }
19
+ ],
20
+ "clearart": [
21
+ {
22
+ "id": "14250",
23
+ "url": "http://assets.fanart.tv/fanart/tv/75682/clearart/bones-4eab178bc58f5.png",
24
+ "lang": "en",
25
+ "likes": "1"
26
+ }
27
+ ],
28
+ "showbackground": [
29
+ {
30
+ "id": "19406",
31
+ "url": "http://assets.fanart.tv/fanart/tv/75682/showbackground/bones-5009b50a325c0.jpg",
32
+ "lang": "en",
33
+ "likes": "0",
34
+ "season": "6"
35
+ }
36
+ ],
37
+ "tvthumb": [
38
+ {
39
+ "id": "21774",
40
+ "url": "http://assets.fanart.tv/fanart/tv/75682/tvthumb/bones-5070c9ec8e4de.jpg",
41
+ "lang": "en",
42
+ "likes": "0"
43
+ }
44
+ ],
45
+ "seasonposter": [
46
+ {
47
+ "id": "39989",
48
+ "url": "http://assets.fanart.tv/fanart/tv/75682/seasonposter/bones-536271a12e2e2.jpg",
49
+ "lang": "en",
50
+ "likes": "0"
51
+ }
52
+ ],
53
+ "seasonthumb": [
54
+ {
55
+ "id": "25967",
56
+ "url": "http://assets.fanart.tv/fanart/tv/75682/seasonthumb/bones-5121a2b7215d2.jpg",
57
+ "lang": "en",
58
+ "likes": "0",
59
+ "season": "8"
60
+ }
61
+ ],
62
+ "hdclearart": [
63
+ {
64
+ "id": "22606",
65
+ "url": "http://assets.fanart.tv/fanart/tv/75682/hdclearart/bones-508c48e9824ae.png",
66
+ "lang": "en",
67
+ "likes": "0"
68
+ }
69
+ ],
70
+ "tvbanner": [
71
+ {
72
+ "id": "40209",
73
+ "url": "http://assets.fanart.tv/fanart/tv/75682/tvbanner/bones-536a839d084a7.jpg",
74
+ "lang": "en",
75
+ "likes": "0"
76
+ }
77
+ ],
78
+ "characterart": [
79
+ {
80
+ "id": "22240",
81
+ "url": "http://assets.fanart.tv/fanart/tv/75682/characterart/bones-507d97908963d.png",
82
+ "lang": "en",
83
+ "likes": "0"
84
+ }
85
+ ],
86
+ "tvposter": [
87
+ {
88
+ "id": "36565",
89
+ "url": "http://assets.fanart.tv/fanart/tv/75682/tvposter/bones-52deb10f82d0f.jpg",
90
+ "lang": "en",
91
+ "likes": "0"
92
+ }
93
+ ],
94
+ "seasonbanner": [
95
+ {
96
+ "id": "37718",
97
+ "url": "http://assets.fanart.tv/fanart/tv/75682/seasonbanner/bones-532e0883bb9d7.jpg",
98
+ "lang": "en",
99
+ "likes": "0",
100
+ "season": "1"
101
+ }
102
+ ]
103
+ }
@@ -0,0 +1,26 @@
1
+ [
2
+ {
3
+ "id": "932cb13f-677c-4e63-beb1-fca45574d280",
4
+ "name": "Zazie",
5
+ "new_images": "1",
6
+ "total_images": "23"
7
+ },
8
+ {
9
+ "id": "e20747e7-55a4-452e-8766-7b985585082d",
10
+ "name": "Frank Zappa",
11
+ "new_images": "1",
12
+ "total_images": "71"
13
+ },
14
+ {
15
+ "id": "967002b0-58ef-4b22-a58c-fbc631ff695c",
16
+ "name": "Paul Young",
17
+ "new_images": "1",
18
+ "total_images": "10"
19
+ },
20
+ {
21
+ "id": "97c86b2c-2765-46a2-aef8-76a7e24c430f",
22
+ "name": "XTC",
23
+ "new_images": "10",
24
+ "total_images": "16"
25
+ }
26
+ ]
@@ -0,0 +1,23 @@
1
+ [
2
+ {
3
+ "tmdb_id": "17610",
4
+ "imdb_id": "tt1045778",
5
+ "name": "Year One",
6
+ "new_images": "1",
7
+ "total_images": "7"
8
+ },
9
+ {
10
+ "tmdb_id": "5651",
11
+ "imdb_id": "tt0075376",
12
+ "name": "Up!",
13
+ "new_images": "1",
14
+ "total_images": "1"
15
+ },
16
+ {
17
+ "tmdb_id": "12437",
18
+ "imdb_id": "tt0834001",
19
+ "name": "Underworld: Rise of the Lycans",
20
+ "new_images": "1",
21
+ "total_images": "30"
22
+ }
23
+ ]
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ "id": "79473",
4
+ "name": "Witchblade (2006)",
5
+ "new_images": "2",
6
+ "total_images": "7"
7
+ },
8
+ {
9
+ "id": "83463",
10
+ "name": "United States of Tara",
11
+ "new_images": "3",
12
+ "total_images": "16"
13
+ },
14
+ {
15
+ "id": "70566",
16
+ "name": "Trailer Park Boys",
17
+ "new_images": "16",
18
+ "total_images": "22"
19
+ }
20
+ ]
@@ -4,44 +4,45 @@ describe FanartApi::Movie do
4
4
  let(:client) { FanartApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
5
5
  let(:model) { client.movie }
6
6
 
7
+ let(:movies_data) { File.read('spec/fixtures/find_movies.json') }
7
8
  let(:movies_data) { File.read('spec/fixtures/find_movies.json') }
8
9
 
9
10
  let(:faraday_stubs) do
10
11
  Faraday::Adapter::Test::Stubs.new do |stub|
11
- stub.get('/webservice/movie/123456789/1234/json/all/1/2') { [200, { content_type: 'json' }, movies_data] }
12
- stub.get('/webservice/newmovies/123456789/123') { [200, { content_type: 'json' }, {}] }
12
+ stub.get('/v3/movies/1234?api_key=123456789') { [200, { content_type: 'json' }, movies_data] }
13
+ stub.get('/v3/movies/latest?api_key=123456789&date=123') { [200, { content_type: 'json' }, {}] }
13
14
  end
14
15
  end
15
16
 
16
17
  describe '.find' do
17
18
  it 'should return Faraday::Response class' do
18
- model.find(id: 1234, type: 'all', sort: '1', limit: 2).class.should == Faraday::Response
19
+ model.find(id: 1234).class.should == Faraday::Response
19
20
  end
20
21
 
21
22
  it 'should return Hash class for body reponse' do
22
- model.find(id: 1234, type: 'all', sort: '1', limit: 2).body == Hash
23
+ model.find(id: 1234).body == Hash
23
24
  end
24
25
  end
25
26
 
26
27
  describe '.find_url' do
27
28
  it 'should return correct url' do
28
- model.find_url(id: 1234, type: 'all', sort: '1', limit: 2).should == 'http://api.fanart.tv/webservice/movie/123456789/1234/json/all/1/2'
29
+ model.find_url(id: 1234).should == 'http://fanarttv.apiary-proxy.com/v3/movies/1234?api_key=123456789'
29
30
  end
30
31
  end
31
32
 
32
- describe '.update' do
33
+ describe '.latest' do
33
34
  it 'should return Faraday::Response class' do
34
- model.update(timestamp: 123).class.should == Faraday::Response
35
+ model.latest(date: 123).class.should == Faraday::Response
35
36
  end
36
37
 
37
38
  it 'should return Hash class for body reponse' do
38
- model.update(timestamp: 123).body == Hash
39
+ model.latest(date: 123).body == Hash
39
40
  end
40
41
  end
41
42
 
42
- describe '.update_url' do
43
+ describe '.latest_url' do
43
44
  it 'should return correct url' do
44
- model.update_url(timestamp: 123).should == 'http://api.fanart.tv/webservice/newmovies/123456789/123'
45
+ model.latest_url(date: 123).should == 'http://fanarttv.apiary-proxy.com/v3/movies/latest?api_key=123456789&date=123'
45
46
  end
46
47
  end
47
48
  end
@@ -5,77 +5,78 @@ describe FanartApi::Music do
5
5
  let(:model) { client.music }
6
6
 
7
7
  let(:music_data) { File.read('spec/fixtures/artist.json') }
8
+ let(:latest_music_data) { File.read('spec/fixtures/latest_artist.json') }
8
9
 
9
10
  let(:faraday_stubs) do
10
11
  Faraday::Adapter::Test::Stubs.new do |stub|
11
- stub.get('/webservice/artist/123456789/1234/json/all/1/2') { [200, { content_type: 'json' }, music_data] }
12
- stub.get('/webservice/album/123456789/1234/json/all/1/2') { [200, { content_type: 'json' }, music_data] }
13
- stub.get('/webservice/label/123456789/1234/json/all/1/2') { [200, { content_type: 'json' }, music_data] }
14
- stub.get('/webservice/newmusic/123456789/123') { [200, { content_type: 'json' }, {}] }
12
+ stub.get('/v3/music/1234?api_key=123456789') { [200, { content_type: 'json' }, music_data] }
13
+ stub.get('/v3/music/albums/1234?api_key=123456789') { [200, { content_type: 'json' }, music_data] }
14
+ stub.get('/v3/music/labels/1234?api_key=123456789') { [200, { content_type: 'json' }, music_data] }
15
+ stub.get('/v3/music/latest?api_key=123456789&date=123') { [200, { content_type: 'json' }, latest_music_data] }
15
16
  end
16
17
  end
17
18
 
18
19
  describe '.artist' do
19
20
  it 'should return Faraday::Response class' do
20
- model.artist(id: 1234, type: 'all', sort: '1', limit: 2).class.should == Faraday::Response
21
+ model.artist(id: 1234).class.should == Faraday::Response
21
22
  end
22
23
 
23
24
  it 'should return Hash class for body reponse' do
24
- model.artist(id: 1234, type: 'all', sort: '1', limit: 2).body == Hash
25
+ model.artist(id: 1234).body == Hash
25
26
  end
26
27
  end
27
28
 
28
29
  describe '.artist_url' do
29
30
  it 'should return correct url' do
30
- model.artist_url(id: 1234, type: 'all', sort: '1', limit: 2).should == 'http://api.fanart.tv/webservice/artist/123456789/1234/json/all/1/2'
31
+ model.artist_url(id: 1234).should == 'http://fanarttv.apiary-proxy.com/v3/music/1234?api_key=123456789'
31
32
  end
32
33
  end
33
34
 
34
35
  describe '.album' do
35
36
  it 'should return Faraday::Response class' do
36
- model.album(id: 1234, type: 'all', sort: '1', limit: 2).class.should == Faraday::Response
37
+ model.album(id: 1234).class.should == Faraday::Response
37
38
  end
38
39
 
39
40
  it 'should return Hash class for body reponse' do
40
- model.album(id: 1234, type: 'all', sort: '1', limit: 2).body == Hash
41
+ model.album(id: 1234).body == Hash
41
42
  end
42
43
  end
43
44
 
44
45
  describe '.album_url' do
45
46
  it 'should return correct url' do
46
- model.album_url(id: 1234, type: 'all', sort: '1', limit: 2).should == 'http://api.fanart.tv/webservice/album/123456789/1234/json/all/1/2'
47
+ model.album_url(id: 1234).should == 'http://fanarttv.apiary-proxy.com/v3/music/albums/1234?api_key=123456789'
47
48
  end
48
49
  end
49
50
 
50
51
  describe '.label' do
51
52
  it 'should return Faraday::Response class' do
52
- model.label(id: 1234, type: 'all', sort: '1', limit: 2).class.should == Faraday::Response
53
+ model.label(id: 1234).class.should == Faraday::Response
53
54
  end
54
55
 
55
56
  it 'should return Hash class for body reponse' do
56
- model.label(id: 1234, type: 'all', sort: '1', limit: 2).body == Hash
57
+ model.label(id: 1234).body == Hash
57
58
  end
58
59
  end
59
60
 
60
61
  describe '.label_url' do
61
62
  it 'should return correct url' do
62
- model.label_url(id: 1234, type: 'all', sort: '1', limit: 2).should == 'http://api.fanart.tv/webservice/label/123456789/1234/json/all/1/2'
63
+ model.label_url(id: 1234).should == 'http://fanarttv.apiary-proxy.com/v3/music/labels/1234?api_key=123456789'
63
64
  end
64
65
  end
65
66
 
66
- describe '.update' do
67
+ describe '.latest' do
67
68
  it 'should return Faraday::Response class' do
68
- model.update(timestamp: 123).class.should == Faraday::Response
69
+ model.latest(date: 123).class.should == Faraday::Response
69
70
  end
70
71
 
71
72
  it 'should return Hash class for body reponse' do
72
- model.update(timestamp: 123).body == Hash
73
+ model.latest(date: 123).body == Hash
73
74
  end
74
75
  end
75
76
 
76
- describe '.update_url' do
77
+ describe '.latest_url' do
77
78
  it 'should return correct url' do
78
- model.update_url(timestamp: 123).should == 'http://api.fanart.tv/webservice/newmusic/123456789/123'
79
+ model.latest_url(date: 123).should == 'http://fanarttv.apiary-proxy.com/v3/music/latest?api_key=123456789&date=123'
79
80
  end
80
81
  end
81
82
  end
@@ -4,44 +4,45 @@ describe FanartApi::Tv do
4
4
  let(:client) { FanartApi::Client.new(api_key: '123456789', adapter: :test, adapter_options: faraday_stubs) }
5
5
  let(:model) { client.tv }
6
6
 
7
- let(:tv_data) { File.read('spec/fixtures/find_series.json') }
7
+ let(:tv_data) { File.read('spec/fixtures/find_tv.json') }
8
+ let(:latest_tv_data) { File.read('spec/fixtures/latest_tv.json') }
8
9
 
9
10
  let(:faraday_stubs) do
10
11
  Faraday::Adapter::Test::Stubs.new do |stub|
11
- stub.get('/webservice/series/123456789/1234/json/all/1/2') { [200, { content_type: 'json' }, tv_data] }
12
- stub.get('/webservice/newtv/123456789/123') { [200, { content_type: 'json' }, {}] }
12
+ stub.get('/v3/tv/1234?api_key=123456789') { [200, { content_type: 'json' }, tv_data] }
13
+ stub.get('/v3/tv/latest?api_key=123456789&date=123') { [200, { content_type: 'json' }, latest_tv_data] }
13
14
  end
14
15
  end
15
16
 
16
17
  describe '.find' do
17
18
  it 'should return Faraday::Response class' do
18
- model.find(id: 1234, type: 'all', sort: '1', limit: 2).class.should == Faraday::Response
19
+ model.find(id: 1234).class.should == Faraday::Response
19
20
  end
20
21
 
21
22
  it 'should return Hash class for body reponse' do
22
- model.find(id: 1234, type: 'all', sort: '1', limit: 2).body == Hash
23
+ model.find(id: 1234).body == Hash
23
24
  end
24
25
  end
25
26
 
26
27
  describe '.find_url' do
27
28
  it 'should return correct url' do
28
- model.find_url(id: 1234, type: 'all', sort: '1', limit: 2).should == 'http://api.fanart.tv/webservice/series/123456789/1234/json/all/1/2'
29
+ model.find_url(id: 1234).should == 'http://fanarttv.apiary-proxy.com/v3/tv/1234?api_key=123456789'
29
30
  end
30
31
  end
31
32
 
32
- describe '.update' do
33
+ describe '.latest' do
33
34
  it 'should return Faraday::Response class' do
34
- model.update(timestamp: 123).class.should == Faraday::Response
35
+ model.latest(date: 123).class.should == Faraday::Response
35
36
  end
36
37
 
37
38
  it 'should return Hash class for body reponse' do
38
- model.update(timestamp: 123).body == Hash
39
+ model.latest(date: 123).body == Array
39
40
  end
40
41
  end
41
42
 
42
- describe '.update_url' do
43
+ describe '.latest_url' do
43
44
  it 'should return correct url' do
44
- model.update_url(timestamp: 123).should == 'http://api.fanart.tv/webservice/newtv/123456789/123'
45
+ model.latest_url(date: 123).should == 'http://fanarttv.apiary-proxy.com/v3/tv/latest?api_key=123456789&date=123'
45
46
  end
46
47
  end
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanart_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Wawer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: service_api
@@ -103,7 +103,10 @@ files:
103
103
  - lib/fanart_api/version.rb
104
104
  - spec/fixtures/artist.json
105
105
  - spec/fixtures/find_movies.json
106
- - spec/fixtures/find_series.json
106
+ - spec/fixtures/find_tv.json
107
+ - spec/fixtures/latest_artist.json
108
+ - spec/fixtures/latest_movies.json
109
+ - spec/fixtures/latest_tv.json
107
110
  - spec/functionals/movie_spec.rb
108
111
  - spec/functionals/music_spec.rb
109
112
  - spec/functionals/tv_spec.rb
@@ -138,7 +141,10 @@ summary: Ruby client for fanart.tv API
138
141
  test_files:
139
142
  - spec/fixtures/artist.json
140
143
  - spec/fixtures/find_movies.json
141
- - spec/fixtures/find_series.json
144
+ - spec/fixtures/find_tv.json
145
+ - spec/fixtures/latest_artist.json
146
+ - spec/fixtures/latest_movies.json
147
+ - spec/fixtures/latest_tv.json
142
148
  - spec/functionals/movie_spec.rb
143
149
  - spec/functionals/music_spec.rb
144
150
  - spec/functionals/tv_spec.rb
@@ -1,36 +0,0 @@
1
- {
2
- "series":"Bones",
3
- "clearlogos":[
4
- {
5
- "id":"13571",
6
- "url":"http:\/\/fanart.tv\/tv\/75682\/clearlogo\/bones-4e764b27c454d.png",
7
- "lang":"ar",
8
- "likes":"0"
9
- }
10
- ],
11
- "cleararts":[
12
- {
13
- "id":"11780",
14
- "url":"http:\/\/fanart.tv\/tv\/75682\/clearart\/bones-4df372a733e83.png",
15
- "lang":"en",
16
- "likes":"0"
17
- }
18
- ],
19
- "tvthumbs":[
20
- {
21
- "id":"4321",
22
- "url":"http:\/\/fanart.tv\/tv\/75682\/tvthumb\/B_75682.jpg",
23
- "lang":"en",
24
- "likes":"0"
25
- }
26
- ],
27
- "seasonthumbs":[
28
- {
29
- "id":"4308",
30
- "url":"http:\/\/fanart.tv\/tv\/75682\/seasonthumb\/Bones (7).jpg",
31
- "lang":"en",
32
- "likes":"0",
33
- "season":"3"
34
- }
35
- ]
36
- }