Skip to content

Commit

Permalink
use ov for info methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wafcio committed Jan 20, 2015
1 parent a7958cc commit fbe4846
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 14 deletions.
6 changes: 3 additions & 3 deletions lib/tvrage_api.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TvrageApi
module Request; end
end
require 'ov'

module TvrageApi; end

require 'tvrage_api/version'
require 'tvrage_api/client'
Expand Down
67 changes: 57 additions & 10 deletions lib/tvrage_api/info.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
class TvrageApi::Info < TvrageApi::Base
include Ov

# Quick information about tv show
#
# access: FREE
# param (flat params):
# find(show, episode, exact)
# find('buffy', nil, nil)
# find('buffy', '1x01', nil)
# find('buffy', nil, 1)
# param (hash params):
# param:
# find('buffy')
# output: Faraday::Response instance with string
let :find, String do |show|
find(show: show)
end

# Quick information about tv show
#
# access: FREE
# param:
# find('buffy', episode: '1x01')
# find('buffy', exact: 1)
# output: Faraday::Response instance with string
let :find, String, Hash do |show, optional_options|
find(optional_options.merge(show: show))
end

# Quick information about tv show
#
# access: FREE
# param:
# find(show: 'buffy')
# find(show: 'buffy', episode: '1x01')
# find(show: 'buffy', exact: 1)
# output: Faraday::Response instance with string
def find(*options)
find_path_with_params(*options).get
let :find, Hash do |options|
find_path_with_params(options).get
end

# Quick information about tv show - return only url
Expand All @@ -33,6 +49,37 @@ def find_url(*options)
find_path_with_params(*options).url
end

# Quick information about tv show - return only url
#
# access: FREE
# param:
# find_url('buffy')
# output: url string
let :find_url, String do |show|
find_url(show: show)
end

# Quick information about tv show - return only url
#
# access: FREE
# param:
# find_url('buffy', episode: '1x01')
# find_url('buffy', exact: 1)
# output: url string
let :find_url, String, Hash do |show, optional_options|
find_url(optional_options.merge(show: show))
end

# Quick information about tv show - return only url
#
# access: FREE
# param:
# find_url(show: 'buffy')
# output: url string
let :find_url, Hash do |options|
find_path_with_params(options).url
end

private

def find_path_with_params(*options)
Expand Down
3 changes: 2 additions & 1 deletion tvrage_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_runtime_dependency 'service_api', '0.0.9'
spec.add_runtime_dependency 'service_api', '~> 0.1.0'
spec.add_runtime_dependency 'ov', '~> 0.1.0'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
Expand Down

0 comments on commit fbe4846

Please sign in to comment.