tmdb_trailer 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
data/lib/tmdb_trailer.rb CHANGED
@@ -11,26 +11,17 @@ module TMDB
11
11
  API_KEY = File.read(File.join(File.expand_path(File.dirname(__FILE__)), "secret.txt")).gsub("\n","")
12
12
  NEXT_PAGE = 1
13
13
  # country - country code i.e "us" for united states, "hk" for hongkong
14
- # mode - use "production" when using for production
15
- # - use "test" for testing
16
- def initialize(country,mode)
14
+ # db_name - database name to store mongo documents, will create one for you if it doesnt exists
15
+ def initialize(country,db_name)
17
16
  @base_uri = "http://api.themoviedb.org/2.1/Movie.browse/en-US/json/"
18
17
  @country = country
19
- if mode == "production"
20
- db_name = "grindbox"
21
- pstore_name = "country_progress.pstore"
22
- elsif mode == "test"
23
- db_name = "test"
24
- pstore_name = "test.pstore"
25
- else
26
- puts "Incorrect Mode: should be 'production' or 'test'"
27
- end
18
+
28
19
  #initialize the mongoDB connection
29
20
  @db = Mongo::Connection.new.db(db_name)
30
- @pstore = PStore.new(pstore_name)
21
+ @pstore = PStore.new("#{db_name}.pstore")
31
22
  @coll = @db["movies"]
32
- #if mongo collection does not exist,
33
- # create index to avoid duplicate documents
23
+
24
+ #if mongo collection does not exist, create index to avoid duplicate documents
34
25
  if @coll.count == 0
35
26
  @coll.create_index("name", :unique => true)
36
27
  end
data/spec/test.pstore CHANGED
@@ -1 +1 @@
1
- {"czi"nzi"bri
1
+ {"nzi"czi"bri
data/tmdb_trailer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tmdb_trailer}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["redgetan"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmdb_trailer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 7
10
+ version: 0.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - redgetan