tv_maze 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -11
- data/lib/tv_maze/api.rb +2 -2
- data/lib/tv_maze/representers/show_representer.rb +1 -0
- data/lib/tv_maze/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0c363f285a82a611adb10885c4cf35b9c2419e7
|
4
|
+
data.tar.gz: 2874ca424702130b263eb3f1521e2fa1100fad00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f79a78f2b595bd66562c39adba03dfdfd0d4eed11749410bf77017f38e3699a5f96b9682a505f87c9ad4f17be79a49782033bdca2c11d699588ec45f838458
|
7
|
+
data.tar.gz: 8e84302d1e487969b7021583c091064b8adbc2599a38d2be465a9aa6b37e648888bd6abc899add312f33816c2e51c75c74730338da142ffa963a9885e5888e2f
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
1
|
+
## Information
|
2
2
|
|
3
|
-
|
3
|
+
### tv_maze [![Code Climate](https://codeclimate.com/github/naveed-ahmad/tv_maze/badges/gpa.svg)](https://codeclimate.com/github/naveed-ahmad/tv_maze) [![Gem Version](https://badge.fury.io/rb/tv_maze.svg)](https://badge.fury.io/rb/tv_maze)
|
4
4
|
|
5
|
-
|
5
|
+
A Ruby wrapper for the [Tv Maze](www.tvmaze.com/api).
|
6
|
+
Provides a simple, easy to use interface for the TvMaze API.
|
7
|
+
|
8
|
+
## Getting started
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
8
11
|
|
@@ -11,22 +14,56 @@ gem 'tv_maze'
|
|
11
14
|
```
|
12
15
|
|
13
16
|
And then execute:
|
14
|
-
|
15
|
-
|
17
|
+
```bash
|
18
|
+
$ bundle install
|
19
|
+
```
|
16
20
|
|
17
21
|
Or install it yourself as:
|
18
|
-
|
19
|
-
|
22
|
+
```bash
|
23
|
+
$ gem install tv_maze
|
24
|
+
```
|
20
25
|
|
21
26
|
## Usage
|
27
|
+
|
22
28
|
```ruby
|
23
|
-
|
29
|
+
TvMaze::Show.find(show_id)
|
30
|
+
TvMaze::Show.cast(show_id)
|
31
|
+
TvMaze::Show.alternative_names(show_id)
|
32
|
+
TvMaze::Show.seasons(show_id)
|
33
|
+
TvMaze::Show.find_by_imdb_id(imdb_id)
|
34
|
+
TvMaze::Show.find_by_tvrage_id(tvrage_id)
|
35
|
+
TvMaze::Show.find_by_tvdb_id(tvdb_id)
|
36
|
+
TvMaze::Show.all(page)
|
37
|
+
TvMaze::Show.search(query)
|
38
|
+
```
|
24
39
|
|
25
|
-
|
26
|
-
=> {"moji"=>"❤", "unicode"=>"2764", "unicode_alternates"=>["2764-FE0F"], "name"=>"heart", "shortname"=>":heart:", "category"=>"symbols", "aliases"=>[], "aliases_ascii"=>["<3"], "keywords"=>["like", "love", "red", "pink", "black", "heart", "love", "passion", "romance", "intense", "desire", "death", "evil", "cold", "valentines"], "description"=>"heavy black heart"}
|
40
|
+
### Examples
|
27
41
|
|
42
|
+
## Show detail
|
43
|
+
```ruby
|
44
|
+
> show = TvMaze::Show.find(1)
|
45
|
+
=> #<TvMaze::Show id=1, name="Under the Dome", type="Scripted", ...
|
46
|
+
> show.name
|
47
|
+
=> "Under the Dome"
|
48
|
+
> show.type
|
49
|
+
=> "Scripted"
|
50
|
+
> show.network
|
51
|
+
=> #<TvMaze::Network id=2, name="CBS", country=#<TvMaze::Country name="United States", code="US", timezone="America/New_York">>
|
52
|
+
> show.external_ids
|
53
|
+
=> #<TvMaze::ExternalIds tvrage=25988, thetvdb=264492, imdb="tt1553656">
|
54
|
+
> show.airing_schedule
|
55
|
+
=> #<TvMaze::AiringSchedule time="22:00", days=["Thursday"]>
|
56
|
+
```
|
28
57
|
|
29
|
-
##
|
58
|
+
## Cast details
|
59
|
+
```ruby
|
60
|
+
> show = TvMaze::Show.cast(1)
|
61
|
+
=> [#<TvMaze::Cast person=#<TvMaze::Person id=9, name="Dean Norris", image=#<TvMaze::Image ...
|
62
|
+
```
|
63
|
+
## Embeding
|
64
|
+
```ruby
|
65
|
+
# fetc cast, episoes and next episodes data as well
|
66
|
+
> TvMaze::Show.find(17153, embed: ['episodes', 'cast', 'nextepisode'])
|
30
67
|
```
|
31
68
|
|
32
69
|
## Development
|
data/lib/tv_maze/api.rb
CHANGED
@@ -13,8 +13,8 @@ module TvMaze
|
|
13
13
|
def url_for(action, params={})
|
14
14
|
url = URI.join(base_url, action)
|
15
15
|
|
16
|
-
if params[
|
17
|
-
params['embed[]'] = params.delete(
|
16
|
+
if params[:embed]
|
17
|
+
params['embed[]'] = params.delete(:embed)
|
18
18
|
end
|
19
19
|
|
20
20
|
url.query = URI.encode_www_form(params) if params
|
@@ -22,6 +22,7 @@ module TvMaze::ShowRepresenter
|
|
22
22
|
nested :_embedded do
|
23
23
|
collection :cast, class: TvMaze::Cast, extend: TvMaze::CastRepresenter
|
24
24
|
collection :episodes, class: TvMaze::Episode, extend: TvMaze::EpisodeRepresenter
|
25
|
+
property :next_episode, as: :nextepisode, extend: TvMaze::EpisodeRepresenter, class: TvMaze::Episode
|
25
26
|
end
|
26
27
|
|
27
28
|
#end
|
data/lib/tv_maze/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tv_maze
|
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
|
- Naveed Ahmad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|