serenity_now 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in serenity_now.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Marcos Trovilho
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ SerenityNow
2
+ ===========
3
+
4
+ Minimalist Ruby wrapper for [TVRage API][rage].
5
+
6
+ "Serenity now, insanity later"
7
+
8
+
9
+ Installation
10
+ ------------
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'serenity_now'
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install serenity_now
23
+
24
+
25
+ Usage
26
+ -----
27
+
28
+ @api = SerenityNow::SerenityAPI.new
29
+ @api.search('buffy')
30
+ @api.search('buffy', true) # for detailed show info
31
+
32
+
33
+ Contributing
34
+ ------------
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
41
+
42
+
43
+ License
44
+ -------
45
+
46
+ [MIT][license]
47
+
48
+
49
+ [rage]: http://services.tvrage.com/
50
+ [license]: https://github.com/mtrovilho/serenity_now/blob/master/LICENSE
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,64 @@
1
+ require 'httparty'
2
+ # (http://services.tvrage.com/info.php?page=main)
3
+ #
4
+ # TVRage API
5
+ # ==========
6
+ # Base URI http://services.tvrage.com/feeds
7
+ #
8
+ # XML Feeds
9
+ # ---------
10
+ # Search /search.php?show=SHOWNAME
11
+ # Detailed Search /full_search.php?show=SHOWNAME
12
+ # Show Info /showinfo.php?sid=SHOWID
13
+ # Show Info + Episode List /full_show_info.php?sid=SHOWID
14
+ # Episode List /episode_list.php?sid=SHOWID
15
+ # Episode Info /episodeinfo.php?show=SHOWNAME&exact=1&ep=SEASONxEPISODE
16
+ #
17
+ # Examples for 'Buffy'
18
+ # --------------------
19
+ # Search /search.php?show=buffy
20
+ # Detailed Search /full_search.php?show=buffy
21
+ # Show Info /showinfo.php?sid=2930
22
+ # Show Info + Episode List /full_show_info.php?sid=2930
23
+ # Episode List /episode_list.php?sid=2930
24
+ # Episode Info /episodeinfo.php?sid=2930&ep=2x04
25
+ #
26
+
27
+ module SerenityNow
28
+ class SerenityAPI
29
+ include HTTParty
30
+ base_uri 'http://services.tvrage.com/feeds'
31
+
32
+ #
33
+ # Search and Detailed Search
34
+ #
35
+ def search( show_name, detailed = false )
36
+ endpoint = detailed ? '/full_search.php' : '/search.php'
37
+ self.class.get( endpoint, query: { show: show_name } )
38
+ end
39
+
40
+ #
41
+ # Show Info and Show Info + Episode List
42
+ #
43
+ def info( show_id, episodes = false )
44
+ endpoint = episodes ? '/full_show_info.php' : '/showinfo.php'
45
+ self.class.get( endpoint, query: { sid: show_id } )
46
+ end
47
+
48
+ #
49
+ # Episode List
50
+ #
51
+ def list( show_id )
52
+ self.class.get( '/episode_list.php', query: { sid: show_id } )
53
+ end
54
+
55
+ #
56
+ # Episode Info
57
+ #
58
+ def e_info( show_id, episode )
59
+ query = { sid: show_id, ep: episode }
60
+ self.class.get( '/episodeinfo.php', query: query )
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ module SerenityNow
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1 @@
1
+ require "serenity_now/serenity_api"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'serenity_now/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "serenity_now"
8
+ gem.version = SerenityNow::VERSION
9
+ gem.authors = ["Marcos Trovilho"]
10
+ gem.email = ["marcos@trovilho.com"]
11
+ gem.summary = "Minimalist Ruby wrapper for TVRage API"
12
+ gem.description = "Uses httparty to get TVRage's xml data (from http://services.tvrage.com)"
13
+ gem.homepage = "https://github.com/lpsBetty/serenity_now"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'httparty'
21
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serenity_now
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Marcos Trovilho
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Uses httparty to get TVRage's xml data (from http://services.tvrage.com)
31
+ email:
32
+ - marcos@trovilho.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/serenity_now.rb
43
+ - lib/serenity_now/serenity_api.rb
44
+ - lib/serenity_now/version.rb
45
+ - serenity_now.gemspec
46
+ homepage: https://github.com/lpsBetty/serenity_now
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 1.8.24
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Minimalist Ruby wrapper for TVRage API
70
+ test_files: []
71
+ has_rdoc: