myshows 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- A 첮
2
- ����Y�!�}�������ӂ�M�u't�7��W�ϴ�%Sf}�C,�u�_ LF�>l��wH����3�Vz`��^#�ٍG|p��w�L>6wPrި^[,����`�8FB>FY'=-5�+.�;��p.�q9�8(����^,��pڞ�!B/`����=\��xp�i#<w|����ju�,������M�� �g�[]����#�>L��er{����tR4*�u��p��m֖#K�}�05��I0
1
+ Y x�=k:�֟�(=>G�~}z����S�oGc�`w�Wlwn���Լ��~,� �����K��j����)�h�H�h?;/���|�ˇ6�?�2A�Q0��gQ�� ����њм��4=��ox��
data/Manifest CHANGED
@@ -1,6 +1,7 @@
1
1
  Manifest
2
- README
2
+ README.rdoc
3
3
  Rakefile
4
+ all-api.rb
4
5
  lib/myshows.rb
5
6
  lib/myshows/api.rb
6
7
  lib/myshows/episode.rb
@@ -0,0 +1,41 @@
1
+ == MyShows API
2
+ Object-oriented wrapper over API of http://myshows.ru
3
+
4
+ === Usage
5
+ Simply require
6
+ require 'rubygems'
7
+ require 'myshows'
8
+ And use
9
+ # authorization is needed for some features
10
+ # requires valid login and md5(password)
11
+ profile = MyShows::Profile.new 'demo', 'fe01ce2a7fbac8fafaed7c982a04e229'
12
+ profile.shows # => all user shows
13
+
14
+ search = MyShows::Search.new
15
+ tbbt = search.show("The Big Bang Theory").first
16
+ tbbt.title # => "The Big Bang Theory"
17
+ tbbt.ru_title # => "Теория большого взрыва"
18
+ # and many other fields provided by API
19
+
20
+ tbbt.episodes # => [...] - all episodes
21
+ pilot = tbbt.episode 1, 1
22
+ pilot.title # => "Pilot"
23
+ pilot.show # => tbbt
24
+ pilot.air_date # => "24.09.2007" (fields parsing would be done later)
25
+ # and many other fields provided by API
26
+
27
+ # if you are authorized:
28
+ pilot.uncheck! # => this episode would be marked as 'unwatched'
29
+ pilot.check! # => this episode would be marked as 'watched'
30
+
31
+ Look at http://rubydoc.info/gems/myshows/ for detailed documentation
32
+
33
+ === Tests
34
+ rake spec
35
+
36
+ === TODO
37
+ - support all API (other user profiles, all unwatched episodes, ...)
38
+ - show and episode fields conversion to Ruby types
39
+
40
+ === Author
41
+ Vladimir Parfinenko, write at vladimir[dot]parfinenko[at]gmail[dot]com
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('myshows', '0.1.0') do |p|
5
+ Echoe.new('myshows', '0.1.1') do |p|
6
6
  p.summary = "MyShows API"
7
7
  p.description = "Object-oriented wrapper over API of http://myshows.ru"
8
8
  p.url = "http://github.com/cypok/myshows"
@@ -1,8 +1,8 @@
1
1
  $: << File.expand_path(File.dirname(__FILE__))
2
2
 
3
- module MyShows
4
- autoload :Profile, 'myshows/profile'
5
- autoload :Search, 'myshows/search'
3
+ require 'myshows/profile'
4
+ require 'myshows/search'
6
5
 
6
+ module MyShows
7
7
  class Error < StandardError; end
8
8
  end
@@ -4,12 +4,12 @@ require 'crack/json'
4
4
  require 'memoize'
5
5
  require 'singleton'
6
6
 
7
+ require 'myshows/show'
8
+ require 'myshows/episode'
9
+
7
10
  JSON = Crack::JSON
8
11
 
9
12
  module MyShows
10
- autoload :Show, 'myshows/show'
11
- autoload :Episode, 'myshows/episode'
12
-
13
13
  class API
14
14
  include Singleton
15
15
 
@@ -1,6 +1,16 @@
1
- module MyShows
2
- autoload :Item, 'myshows/item'
1
+ require 'myshows/item'
3
2
 
3
+ module MyShows
4
+ # Provides such methods:
5
+ # title
6
+ # episode_number
7
+ # season_number
8
+ # short_name
9
+ # air_date
10
+ # sequence_number
11
+ # production_number
12
+ # image
13
+ # tvrage_link
4
14
  class Episode < Item
5
15
  attr_reader :show
6
16
 
@@ -18,10 +28,14 @@ module MyShows
18
28
  "#{show} - #{season_number}x#{episode_number} - #{title}"
19
29
  end
20
30
 
31
+ # Check episode as 'watched',
32
+ # requires authorization via Profile
21
33
  def check!
22
34
  @api.check_episode self
23
35
  end
24
36
 
37
+ # Check episode as 'unwatched',
38
+ # requires authorization via Profile
25
39
  def uncheck!
26
40
  @api.uncheck_episode self
27
41
  end
@@ -1,14 +1,20 @@
1
- module MyShows
2
- autoload :API, 'myshows/api'
1
+ require 'myshows/api'
3
2
 
3
+ module MyShows
4
+ # Profile initialization is needed to gain access
5
+ # to some functions of API
4
6
  class Profile
5
7
 
6
- def initialize(login, password)
8
+ # Login and md5-hashed password of
9
+ # valid account on myshows.ru
10
+ def initialize(login, password_md5)
7
11
  @api = MyShows::API.instance
8
12
 
9
- @api.authorize login, password
13
+ @api.authorize login, password_md5
10
14
  end
11
15
 
16
+ # All active, delayed and cancelled shows
17
+ # of current user
12
18
  def shows
13
19
  @api.user_shows
14
20
  end
@@ -1,12 +1,14 @@
1
- module MyShows
2
- autoload :API, 'myshows/api'
1
+ require 'myshows/api'
3
2
 
4
- # Tools for searching over whole base
3
+ module MyShows
4
+ # Tools for searching over whole base of myshows.ru
5
5
  class Search
6
6
  def initialize
7
7
  @api = MyShows::API.instance
8
8
  end
9
9
 
10
+ # Simple show search by its name,
11
+ # number of results is limited
10
12
  def show(name)
11
13
  @api.search_show name
12
14
  end
@@ -1,5 +1,22 @@
1
+ require 'myshows/item'
2
+
1
3
  module MyShows
2
- autoload :Item, 'myshows/item'
4
+ # Provides such methods:
5
+ # title
6
+ # ru_title
7
+ # rating
8
+ # country
9
+ # started
10
+ # ended
11
+ # runtime
12
+ # voted
13
+ # year
14
+ # genres
15
+ # status
16
+ # watching
17
+ # imdb_id
18
+ # tvrage_id
19
+ # kinopoisk_id
3
20
 
4
21
  class Show < Item
5
22
  def initialize(id, data)
@@ -14,10 +31,12 @@ module MyShows
14
31
  title
15
32
  end
16
33
 
34
+ # Returns all episodes
17
35
  def episodes
18
36
  @api.show_episodes self
19
37
  end
20
38
 
39
+ # Returns episode by season and episode number
21
40
  def episode(season_number, episode_number)
22
41
  episodes.detect {|e| e.season_number == season_number && e.episode_number == episode_number }
23
42
  end
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{myshows}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Vladimir Parfinenko"]
9
9
  s.cert_chain = ["/Users/cypok/.gem/gem-public_cert.pem"]
10
- s.date = %q{2011-01-25}
10
+ s.date = %q{2011-01-26}
11
11
  s.description = %q{Object-oriented wrapper over API of http://myshows.ru}
12
12
  s.email = %q{vladimir.parfinenko@gmail.com}
13
- s.extra_rdoc_files = ["README", "lib/myshows.rb", "lib/myshows/api.rb", "lib/myshows/episode.rb", "lib/myshows/item.rb", "lib/myshows/profile.rb", "lib/myshows/search.rb", "lib/myshows/show.rb"]
14
- s.files = ["Manifest", "README", "Rakefile", "lib/myshows.rb", "lib/myshows/api.rb", "lib/myshows/episode.rb", "lib/myshows/item.rb", "lib/myshows/profile.rb", "lib/myshows/search.rb", "lib/myshows/show.rb", "myshows.gemspec", "spec/myshows_spec.rb"]
13
+ s.extra_rdoc_files = ["README.rdoc", "lib/myshows.rb", "lib/myshows/api.rb", "lib/myshows/episode.rb", "lib/myshows/item.rb", "lib/myshows/profile.rb", "lib/myshows/search.rb", "lib/myshows/show.rb"]
14
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "lib/myshows.rb", "lib/myshows/api.rb", "lib/myshows/episode.rb", "lib/myshows/item.rb", "lib/myshows/profile.rb", "lib/myshows/search.rb", "lib/myshows/show.rb", "myshows.gemspec", "spec/myshows_spec.rb"]
15
15
  s.homepage = %q{http://github.com/cypok/myshows}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Myshows", "--main", "README"]
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Myshows", "--main", "README.rdoc"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{myshows}
19
19
  s.rubygems_version = %q{1.4.2}
@@ -1,6 +1,4 @@
1
1
  require 'myshows'
2
- require 'myshows/show'
3
- require 'myshows/episode'
4
2
 
5
3
  describe MyShows do
6
4
  TBBT = 'The Big Bang Theory'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myshows
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vladimir Parfinenko
@@ -36,7 +36,7 @@ cert_chain:
36
36
  78F0qvtLjR0DAnN6uYs98PR+jHE+0ckLX3D9sw==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-01-25 00:00:00 +06:00
39
+ date: 2011-01-26 00:00:00 +06:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
@@ -102,7 +102,7 @@ executables: []
102
102
  extensions: []
103
103
 
104
104
  extra_rdoc_files:
105
- - README
105
+ - README.rdoc
106
106
  - lib/myshows.rb
107
107
  - lib/myshows/api.rb
108
108
  - lib/myshows/episode.rb
@@ -112,7 +112,7 @@ extra_rdoc_files:
112
112
  - lib/myshows/show.rb
113
113
  files:
114
114
  - Manifest
115
- - README
115
+ - README.rdoc
116
116
  - Rakefile
117
117
  - lib/myshows.rb
118
118
  - lib/myshows/api.rb
@@ -134,7 +134,7 @@ rdoc_options:
134
134
  - --title
135
135
  - Myshows
136
136
  - --main
137
- - README
137
+ - README.rdoc
138
138
  require_paths:
139
139
  - lib
140
140
  required_ruby_version: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file
data/README DELETED
File without changes