tvrage_api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +32 -0
- data/README.md +66 -82
- data/lib/tvrage_api.rb +11 -1
- data/lib/tvrage_api/attributes_mapping/recap/show.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/search/by_name.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/show/episode.rb +6 -0
- data/lib/tvrage_api/attributes_mapping/show/find.rb +5 -0
- data/lib/tvrage_api/info.rb +50 -10
- data/lib/tvrage_api/recap.rb +59 -13
- data/lib/tvrage_api/schedule.rb +74 -14
- data/lib/tvrage_api/search.rb +60 -14
- data/lib/tvrage_api/show.rb +116 -31
- data/lib/tvrage_api/update.rb +36 -10
- data/lib/tvrage_api/version.rb +1 -1
- data/spec/functionals/info_spec.rb +26 -6
- data/spec/functionals/recap_spec.rb +55 -15
- data/spec/functionals/schedule_spec.rb +53 -12
- data/spec/functionals/search_spec.rb +52 -12
- data/spec/functionals/show_spec.rb +104 -24
- data/spec/functionals/update_spec.rb +27 -6
- data/spec/integrations/info_spec.rb +6 -1
- data/spec/integrations/recap_spec.rb +18 -3
- data/spec/integrations/schedule_spec.rb +12 -2
- data/spec/integrations/search_spec.rb +12 -2
- data/spec/integrations/show_spec.rb +30 -5
- data/spec/integrations/update_spec.rb +7 -2
- data/spec/spec_helper.rb +1 -3
- data/tvrage_api.gemspec +5 -2
- metadata +55 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94940bd48b406bc923d98a10f40bf37e3b88eb41
|
4
|
+
data.tar.gz: a874fa0a2f8b0624ff74e6ff591db98753e63155
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c7a32f883b7be3ea42c0a9145e543e1ab1277add7492ec6e90b86704a4c6b7d91e8d0e2520e43f540e06070095221d7b82ccbd1b457e6f1ada3848da2cbed9
|
7
|
+
data.tar.gz: 58bc4b8aba59140e3d758ebd0d393eda81478d20b5d5e6ae33849c3f00a19882e889998dbe5d5f0b0bd1b6ba41a45dc2d610d172f58b64d0ad3ce56145c73e1a
|
data/.rspec
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
## 0.3.0 (January 25, 2015)
|
2
|
+
|
3
|
+
- use ov gem for multimethod
|
4
|
+
- use hashie for normalize params key names
|
5
|
+
|
6
|
+
## 0.2.1 (August 31, 2014)
|
7
|
+
|
8
|
+
- update dependencies
|
9
|
+
- fill documentations
|
10
|
+
|
11
|
+
## 0.2.0 (June 25, 2014)
|
12
|
+
|
13
|
+
- replaced HTTParty by Faraday
|
14
|
+
- refactored Mapper classes
|
15
|
+
|
16
|
+
## 0.1.1 (December 14, 2013)
|
17
|
+
|
18
|
+
- refactored
|
19
|
+
|
20
|
+
## 0.1.0 (December 10, 2013)
|
21
|
+
|
22
|
+
- removed monkey patches for Ruby Core Date Types
|
23
|
+
- removed mapping response to objects
|
24
|
+
- little performance improvement
|
25
|
+
|
26
|
+
## 0.0.2 (December 7, 2013)
|
27
|
+
|
28
|
+
- corrected README
|
29
|
+
|
30
|
+
## 0.0.1 (December 7, 2013)
|
31
|
+
|
32
|
+
First release with HTTParty
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/
|
2
|
-
[![Dependency Status](https://gemnasium.com/
|
3
|
-
[![Code Climate](https://codeclimate.com/github/
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/
|
1
|
+
[![Build Status](https://travis-ci.org/tvapi/tvrage_api.png?branch=master)](https://travis-ci.org/tvapi/tvrage_api)
|
2
|
+
[![Dependency Status](https://gemnasium.com/tvapi/tvrage_api.png)](https://gemnasium.com/tvapi/tvrage_api)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/tvapi/tvrage_api.png)](https://codeclimate.com/github/tvapi/tvrage_api)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/tvapi/tvrage_api/badge.png)](https://coveralls.io/r/tvapi/tvrage_api)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/tvrage_api.png)](http://badge.fury.io/rb/tvrage_api)
|
6
6
|
|
7
7
|
# TvrageApi
|
@@ -23,105 +23,89 @@ You have two way for access to api:
|
|
23
23
|
|
24
24
|
* I way (create client class, one entry point)
|
25
25
|
|
26
|
-
* II way (direct access to api class, many entry points)
|
27
|
-
|
28
|
-
Search show by name:
|
29
|
-
|
30
26
|
```ruby
|
31
27
|
client = TvrageApi::Client.new
|
32
|
-
client.
|
33
|
-
client.
|
28
|
+
client.info # => #<TvrageApi::Info>
|
29
|
+
client.recap # => #<TvrageApi::Recap>
|
30
|
+
client.schedule # => #<TvrageApi::Schedule>
|
31
|
+
client.search # => #<TvrageApi::Search>
|
32
|
+
client.show # => #<TvrageApi::Show>
|
33
|
+
client.update # => #<TvrageApi::Update>
|
34
34
|
```
|
35
35
|
|
36
|
+
* II way (direct access to api class, many entry points)
|
37
|
+
|
36
38
|
```ruby
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
TvrageApi::Info.new
|
40
|
+
TvrageApi::Recap.new
|
41
|
+
TvrageApi::Schedule.new
|
42
|
+
TvrageApi::Search.new
|
43
|
+
TvrageApi::Show.new
|
44
|
+
TvrageApi::Update.new
|
40
45
|
```
|
41
46
|
|
42
|
-
|
47
|
+
## Methods
|
43
48
|
|
44
|
-
|
45
|
-
client = TvrageApi::Client.new
|
46
|
-
client.show.find(sid: '123')
|
47
|
-
client.show.find_full(sid: '123')
|
48
|
-
client.show.episodes(sid: '123') # show with all episodes
|
49
|
-
client.show.episode(sid: '123', ep: 'SEASONxEPISODE') # show with specific episode
|
50
|
-
client.show.all
|
51
|
-
```
|
49
|
+
For almost all method you can pass hash attributes or multiple attributes specified in method comment.
|
52
50
|
|
53
|
-
|
54
|
-
show = TvrageApi::Show.new
|
55
|
-
show.find(sid: '123')
|
56
|
-
show.find_full(sid: '123')
|
57
|
-
show.episodes(sid: '123') # show with all episodes
|
58
|
-
show.episode(sid: '123', ep: 'SEASONxEPISODE') # show with specific episode
|
59
|
-
show.all
|
60
|
-
```
|
51
|
+
### Info (QuickInfo) methods
|
61
52
|
|
62
|
-
|
53
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/info.rb
|
63
54
|
|
64
|
-
|
65
|
-
|
66
|
-
client.info.find(show: 'Alias') # main information
|
67
|
-
client.info.find(show: 'Alias', ep: '2x04') # episode information
|
68
|
-
client.info.find(show: 'Alias', exact: 1) # exact information
|
69
|
-
```
|
55
|
+
* find
|
56
|
+
* find_url
|
70
57
|
|
71
|
-
|
72
|
-
info = TvrageApi::Info.new
|
73
|
-
info.find(show: 'Alias') # main information
|
74
|
-
info.find(show: 'Alias', ep: '2x04') # episode information
|
75
|
-
info.find(show: 'Alias', exact: 1) # exact information
|
76
|
-
```
|
58
|
+
### Recap methods
|
77
59
|
|
78
|
-
|
60
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/recap.rb
|
79
61
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
62
|
+
* all
|
63
|
+
* all_url
|
64
|
+
* show
|
65
|
+
* show_url
|
66
|
+
* last
|
67
|
+
* last_url
|
85
68
|
|
86
|
-
|
87
|
-
schedule = TvrageApi::Schedule.new
|
88
|
-
schedule.quick
|
89
|
-
schedule.full(country: 'US')
|
90
|
-
```
|
69
|
+
### Schedule methods
|
91
70
|
|
92
|
-
|
71
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/schedule.rb
|
93
72
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
client.recap.last(days: 100)
|
99
|
-
```
|
73
|
+
* quick
|
74
|
+
* quick_url
|
75
|
+
* full
|
76
|
+
* full_url
|
100
77
|
|
101
|
-
|
102
|
-
recaps = TvrageApi::Recaps.new
|
103
|
-
recap.all
|
104
|
-
recap.show(show: 5410)
|
105
|
-
recap.last(days: 100)
|
106
|
-
```
|
78
|
+
### Search methods
|
107
79
|
|
108
|
-
|
80
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/search.rb
|
109
81
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
client.update.last(sort: 'episodes') # only shows where episodes have changed
|
115
|
-
client.update.last(since: 1403668430) # updates since last visit
|
116
|
-
```
|
82
|
+
* by_name
|
83
|
+
* by_name_url
|
84
|
+
* full_by_name
|
85
|
+
* full_by_name_url
|
117
86
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
87
|
+
### Show (search show) methods
|
88
|
+
|
89
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/show.rb
|
90
|
+
|
91
|
+
* find
|
92
|
+
* find_url
|
93
|
+
* find_full
|
94
|
+
* find_full_url
|
95
|
+
* episodes
|
96
|
+
* episodes_url
|
97
|
+
* episode
|
98
|
+
* episode_url
|
99
|
+
* all
|
100
|
+
* all_url
|
101
|
+
|
102
|
+
|
103
|
+
### Update methods
|
104
|
+
|
105
|
+
For method attributes read https://github.com/tvapi/tvrage_api/blob/master/lib/tvrage_api/update.rb
|
106
|
+
|
107
|
+
* last
|
108
|
+
* last_url
|
125
109
|
|
126
110
|
## Contributing
|
127
111
|
|
data/lib/tvrage_api.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
require 'ov'
|
2
|
+
|
1
3
|
module TvrageApi
|
2
|
-
module
|
4
|
+
module AttributesMapping
|
5
|
+
module Recap; end
|
6
|
+
module Search; end
|
7
|
+
module Show; end
|
8
|
+
end
|
3
9
|
end
|
4
10
|
|
11
|
+
require 'tvrage_api/attributes_mapping/recap/show'
|
12
|
+
require 'tvrage_api/attributes_mapping/search/by_name'
|
13
|
+
require 'tvrage_api/attributes_mapping/show/episode'
|
14
|
+
require 'tvrage_api/attributes_mapping/show/find'
|
5
15
|
require 'tvrage_api/version'
|
6
16
|
require 'tvrage_api/client'
|
7
17
|
require 'tvrage_api/base'
|
data/lib/tvrage_api/info.rb
CHANGED
@@ -1,25 +1,65 @@
|
|
1
1
|
class TvrageApi::Info < TvrageApi::Base
|
2
|
+
include Ov
|
3
|
+
|
4
|
+
# Quick information about tv show
|
5
|
+
#
|
6
|
+
# access: FREE
|
7
|
+
# param:
|
8
|
+
# find('buffy')
|
9
|
+
# output: Faraday::Response instance with string
|
10
|
+
let :find, String do |show|
|
11
|
+
find(show: show)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Quick information about tv show
|
15
|
+
#
|
16
|
+
# access: FREE
|
17
|
+
# param:
|
18
|
+
# find('buffy', episode: '1x01')
|
19
|
+
# find('buffy', exact: 1)
|
20
|
+
# output: Faraday::Response instance with string
|
21
|
+
let :find, String, Hash do |show, optional_options|
|
22
|
+
find(optional_options.merge(show: show))
|
23
|
+
end
|
24
|
+
|
2
25
|
# Quick information about tv show
|
3
26
|
#
|
4
27
|
# access: FREE
|
5
|
-
# param:
|
6
|
-
# show:
|
7
|
-
# ep: episode name, format [Season Number]x[Episode Number, with zero at the beginning for 1-9] (optional)
|
8
|
-
# exact: 1, Only shows that match exactly will be given.
|
28
|
+
# param:
|
29
|
+
# find(show: 'buffy')
|
9
30
|
# output: Faraday::Response instance with string
|
10
|
-
|
31
|
+
let :find, Hash do |options|
|
11
32
|
find_path_with_params(options).get
|
12
33
|
end
|
13
34
|
|
14
35
|
# Quick information about tv show - return only url
|
15
36
|
#
|
16
37
|
# access: FREE
|
17
|
-
# param:
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
38
|
+
# param:
|
39
|
+
# find_url('buffy')
|
40
|
+
# output: url string
|
41
|
+
let :find_url, String do |show|
|
42
|
+
find_url(show: show)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Quick information about tv show - return only url
|
46
|
+
#
|
47
|
+
# access: FREE
|
48
|
+
# param:
|
49
|
+
# find_url('buffy', episode: '1x01')
|
50
|
+
# find_url('buffy', exact: 1)
|
51
|
+
# output: url string
|
52
|
+
let :find_url, String, Hash do |show, optional_options|
|
53
|
+
find_url(optional_options.merge(show: show))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Quick information about tv show - return only url
|
57
|
+
#
|
58
|
+
# access: FREE
|
59
|
+
# param:
|
60
|
+
# find_url(show: 'buffy')
|
21
61
|
# output: url string
|
22
|
-
|
62
|
+
let :find_url, Hash do |options|
|
23
63
|
find_path_with_params(options).url
|
24
64
|
end
|
25
65
|
|
data/lib/tvrage_api/recap.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class TvrageApi::Recap < TvrageApi::Base
|
2
|
+
include Ov
|
3
|
+
|
2
4
|
# All recaps
|
3
5
|
#
|
4
6
|
# access: FREE
|
@@ -18,40 +20,80 @@ class TvrageApi::Recap < TvrageApi::Base
|
|
18
20
|
# Recaps From Selected Show
|
19
21
|
#
|
20
22
|
# access: FREE
|
21
|
-
# param:
|
22
|
-
# show
|
23
|
+
# param:
|
24
|
+
# show('1234')
|
25
|
+
# output: Faraday::Response instance with parsed XML string
|
26
|
+
let :show, Any do |id|
|
27
|
+
show(id: id)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Recaps From Selected Show
|
31
|
+
#
|
32
|
+
# access: FREE
|
33
|
+
# param:
|
34
|
+
# show(id: '1234')
|
23
35
|
# output: Faraday::Response instance with parsed XML string
|
24
|
-
|
36
|
+
let :show, Hash do |options|
|
25
37
|
show_path_with_params(options).get
|
26
38
|
end
|
27
39
|
|
28
40
|
# Recaps From Selected Show - return only url
|
29
41
|
#
|
30
42
|
# access: FREE
|
31
|
-
# param:
|
32
|
-
#
|
43
|
+
# param:
|
44
|
+
# show_url(1234)
|
33
45
|
# output: url string
|
34
|
-
|
46
|
+
let :show_url, Any do |id|
|
47
|
+
show_url(id: id)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Recaps From Selected Show - return only url
|
51
|
+
#
|
52
|
+
# access: FREE
|
53
|
+
# param:
|
54
|
+
# show_url(id: 1234)
|
55
|
+
# output: url string
|
56
|
+
let :show_url, Hash do |options|
|
35
57
|
show_path_with_params(options).url
|
36
58
|
end
|
37
59
|
|
38
60
|
# Latest Recaps
|
39
61
|
#
|
40
62
|
# access: FREE
|
41
|
-
# param:
|
42
|
-
#
|
63
|
+
# param:
|
64
|
+
# last(30)
|
43
65
|
# output: Faraday::Response instance with parsed XML string
|
44
|
-
|
66
|
+
let :last, Any do |days|
|
67
|
+
last(days: days)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Latest Recaps
|
71
|
+
#
|
72
|
+
# access: FREE
|
73
|
+
# param:
|
74
|
+
# last(days: 30)
|
75
|
+
# output: Faraday::Response instance with parsed XML string
|
76
|
+
let :last, Hash do |options|
|
45
77
|
last_path_with_params(options).get
|
46
78
|
end
|
47
79
|
|
48
80
|
# Latest Recaps - return only url
|
49
81
|
#
|
50
82
|
# access: FREE
|
51
|
-
# param:
|
52
|
-
#
|
83
|
+
# param:
|
84
|
+
# last_url(30)
|
53
85
|
# output: url string
|
54
|
-
|
86
|
+
let :last_url, Any do |days|
|
87
|
+
last_url(days: days)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Latest Recaps - return only url
|
91
|
+
#
|
92
|
+
# access: FREE
|
93
|
+
# param:
|
94
|
+
# last_url(days: 30)
|
95
|
+
# output: url string
|
96
|
+
let :last_url, Hash do |options|
|
55
97
|
last_path_with_params(options).url
|
56
98
|
end
|
57
99
|
|
@@ -62,7 +104,11 @@ class TvrageApi::Recap < TvrageApi::Base
|
|
62
104
|
end
|
63
105
|
|
64
106
|
def show_path_with_params(options)
|
65
|
-
path(show_path).params(options)
|
107
|
+
path(show_path).params(show_mapped_options(options))
|
108
|
+
end
|
109
|
+
|
110
|
+
def show_mapped_options(options)
|
111
|
+
TvrageApi::AttributesMapping::Recap::Show.new(options).to_hash
|
66
112
|
end
|
67
113
|
|
68
114
|
def show_path
|