traktr 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -6
- data/lib/traktr/activity.rb +70 -0
- data/lib/traktr/activity/user.rb +40 -0
- data/lib/traktr/client.rb +6 -0
- data/lib/traktr/show.rb +0 -5
- data/lib/traktr/version.rb +1 -1
- data/spec/.gitignore +1 -0
- data/spec/activity_spec.rb +127 -0
- data/spec/activity_user_spec.rb +69 -0
- data/spec/spec.yaml.sample +7 -0
- data/spec/spec_helper.rb +9 -3
- metadata +27 -18
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 35dcdf1ab6c39e98d9b42e94f9200abe412e3a7b
         | 
| 4 | 
            +
              data.tar.gz: 54f5fe728f8f6b69ba87aa982ddc2fed6aad30c1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8f9d95f33efc71ca758f0b77d24a7b3072d3e2dc9b55097a0b0d90e0b3dfee4ecacc0cd159ec8beab91aee4195d95c06307cbd490010fa44c4b97dfb3b8739f4
         | 
| 7 | 
            +
              data.tar.gz: 0d7679d865a45535648f005555082bd6bdbb1572094fb199cec6275b426192e914f071e0db49bcd43934d521e4f3c5692a4ff2ecda545da56abac481901deeae
         | 
    
        data/README.md
    CHANGED
    
    | @@ -40,19 +40,41 @@ SHA1_PASSWORD = "57b2ad99044d337197c0c39fd3823568ff81e48a" | |
| 40 40 |  | 
| 41 41 | 
             
            # for non-authenticated methods, you can create an instance without supplying
         | 
| 42 42 | 
             
            # username and password
         | 
| 43 | 
            -
            trakt = Traktr::Client.new(API_KEY)
         | 
| 43 | 
            +
            @trakt = Traktr::Client.new(API_KEY)
         | 
| 44 44 |  | 
| 45 45 | 
             
            # if you need to use an authenticated method, you can provide your plaintext
         | 
| 46 46 | 
             
            # password
         | 
| 47 | 
            -
            trakt = Traktr::Client.new(API_KEY, USERNAME, PASSWORD)
         | 
| 47 | 
            +
            @trakt = Traktr::Client.new(API_KEY, USERNAME, PASSWORD)
         | 
| 48 48 |  | 
| 49 49 | 
             
            # or the SHA1 hash of your password
         | 
| 50 | 
            -
            trakt = Traktr::Client.new(API_KEY, USERNAME, SHA1_PASSWORD, true)
         | 
| 50 | 
            +
            @trakt = Traktr::Client.new(API_KEY, USERNAME, SHA1_PASSWORD, true)
         | 
| 51 51 | 
             
            ```
         | 
| 52 52 |  | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 53 | 
            +
            To get summary info about a movie, use the ```movie.summary``` method:
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            ```ruby
         | 
| 56 | 
            +
            # you can use the trakt.tv slug, IMDB ID, or TMDB ID
         | 
| 57 | 
            +
            tdk = @trakt.movie.summary('the-dark-knight-2008')
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            # tdk is a Mash object that has methods for each field in the summary:
         | 
| 60 | 
            +
            tdk.title
         | 
| 61 | 
            +
            tdk.year
         | 
| 62 | 
            +
            tdk.released
         | 
| 63 | 
            +
            tdk.url
         | 
| 64 | 
            +
            tdk.trailer
         | 
| 65 | 
            +
            tdk.runtime
         | 
| 66 | 
            +
            # etc ...
         | 
| 67 | 
            +
            ```
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            To search for a movie, use the ```search.movies``` method.
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            ```ruby
         | 
| 72 | 
            +
            # returns an array of movie summary results
         | 
| 73 | 
            +
            results = @trakt.search.movies("Dark Knight")
         | 
| 74 | 
            +
            results.each do |r|
         | 
| 75 | 
            +
              puts r.title
         | 
| 76 | 
            +
            end
         | 
| 77 | 
            +
            ```
         | 
| 56 78 |  | 
| 57 79 | 
             
            ## Contributing
         | 
| 58 80 |  | 
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            module Traktr
         | 
| 2 | 
            +
              class Activity
         | 
| 3 | 
            +
                include HTTParty
         | 
| 4 | 
            +
                base_uri File.join(Traktr.base_uri, 'activity')
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                def initialize(client)
         | 
| 7 | 
            +
                  @client = client
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                ##
         | 
| 11 | 
            +
                ## activity GET methods
         | 
| 12 | 
            +
                ##
         | 
| 13 | 
            +
                def community(types = :all, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 14 | 
            +
                  response = self.class.get('/' + File.join('community.json', @client.api_key, types.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 15 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def episodes(title, season, episode, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 21 | 
            +
                  response = self.class.get('/' + File.join('episodes.json', @client.api_key, title, season.to_s, episode.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 22 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 25 | 
            +
                end 
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def movies(title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 28 | 
            +
                  response = self.class.get('/' + File.join('movies.json', @client.api_key, title, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 29 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                def seasons(title, season, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 35 | 
            +
                  response = self.class.get('/' + File.join('seasons.json', @client.api_key, title, season.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 36 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                def shows(title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 42 | 
            +
                  response = self.class.get('/' + File.join('shows.json', @client.api_key, title, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 43 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                def user(username = nil, types = :all, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 49 | 
            +
                  if username
         | 
| 50 | 
            +
                    response = self.class.get('/' + File.join('user.json', @client.api_key, username, types.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 51 | 
            +
                    raise ResponseError.new(response) if response.code != 200
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    Mash.new(response.parsed_response)
         | 
| 54 | 
            +
                  else
         | 
| 55 | 
            +
                    @user ||= Traktr::Activity::User.new(@client)
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                ##
         | 
| 60 | 
            +
                ## activity POST methods
         | 
| 61 | 
            +
                ##
         | 
| 62 | 
            +
                def friends(types = :all, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 63 | 
            +
                  data = { username: @client.username, password: @client.password }
         | 
| 64 | 
            +
                  response = self.class.post('/' + File.join('friends.json', @client.api_key, types.to_s, actions.to_s, start_ts.to_s, end_ts.to_s), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
         | 
| 65 | 
            +
                  raise ResponseError.new(response) if response.code != 200
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  Mash.new(response.parsed_response)
         | 
| 68 | 
            +
                end   
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            module Traktr
         | 
| 2 | 
            +
              class Activity
         | 
| 3 | 
            +
              	class User
         | 
| 4 | 
            +
              	  include HTTParty
         | 
| 5 | 
            +
                  base_uri File.join(Traktr::Activity.base_uri, "user")
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                  def initialize(client)
         | 
| 8 | 
            +
                    @client = client
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def episodes(username, title, season, episode, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 12 | 
            +
                    response = self.class.get('/' + File.join('episodes.json', @client.api_key, username, title, season.to_s, episode.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 13 | 
            +
                    raise ResponseError.new(response) if response.code != 200
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    Mash.new(response.parsed_response)
         | 
| 16 | 
            +
                  end 
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def movies(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 19 | 
            +
                    response = self.class.get('/' + File.join('movies.json', @client.api_key, username, title, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 20 | 
            +
                    raise ResponseError.new(response) if response.code != 200
         | 
| 21 | 
            +
                   
         | 
| 22 | 
            +
                    Mash.new(response.parsed_response)
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  def seasons(username, title, season, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 26 | 
            +
                    response = self.class.get('/' + File.join('seasons.json', @client.api_key, username, title, season.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 27 | 
            +
                    raise ResponseError.new(response) if response.code != 200
         | 
| 28 | 
            +
                   
         | 
| 29 | 
            +
                    Mash.new(response.parsed_response)
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def shows(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
         | 
| 33 | 
            +
                    response = self.class.get('/' + File.join('shows.json', @client.api_key, username, title, actions.to_s, start_ts.to_s, end_ts.to_s))
         | 
| 34 | 
            +
                    raise ResponseError.new(response) if response.code != 200
         | 
| 35 | 
            +
                   
         | 
| 36 | 
            +
                    Mash.new(response.parsed_response)
         | 
| 37 | 
            +
                  end      
         | 
| 38 | 
            +
              	end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
            end
         | 
    
        data/lib/traktr/client.rb
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            require 'digest/sha1'
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'traktr/account'
         | 
| 4 | 
            +
            require 'traktr/activity'
         | 
| 5 | 
            +
            require 'traktr/activity/user'
         | 
| 4 6 | 
             
            require 'traktr/movie'
         | 
| 5 7 | 
             
            require 'traktr/movies'
         | 
| 6 8 | 
             
            require 'traktr/search'
         | 
| @@ -26,6 +28,10 @@ module Traktr | |
| 26 28 | 
             
                  @account ||= Traktr::Account.new(self)
         | 
| 27 29 | 
             
                end
         | 
| 28 30 |  | 
| 31 | 
            +
                def activity
         | 
| 32 | 
            +
                  @activity ||= Traktr::Activity.new(self)
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 29 35 | 
             
                def movie
         | 
| 30 36 | 
             
                  @movie ||= Traktr::Movie.new(self)
         | 
| 31 37 | 
             
                end
         | 
    
        data/lib/traktr/show.rb
    CHANGED
    
    
    
        data/lib/traktr/version.rb
    CHANGED
    
    
    
        data/spec/.gitignore
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            spec.yaml
         | 
| @@ -0,0 +1,127 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Traktr::Activity do
         | 
| 4 | 
            +
              context 'GET methods' do
         | 
| 5 | 
            +
                context 'with valid api_key' do
         | 
| 6 | 
            +
                  before :all do
         | 
| 7 | 
            +
                    @trakt = Traktr::Client.new(API_KEY)
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  context 'with valid query' do
         | 
| 11 | 
            +
                    it '#community' do
         | 
| 12 | 
            +
                      expect( @trakt.activity.community.size ).to be > 0
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    it '#episodes' do
         | 
| 16 | 
            +
                      expect( @trakt.activity.episodes('dexter', 1, 1).activity.class ).to eql(Array)
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    it '#movies' do
         | 
| 20 | 
            +
                      expect( @trakt.activity.movies('the-dark-knight-2008').activity.class ).to eql(Array)
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    it '#seasons' do
         | 
| 24 | 
            +
                      expect( @trakt.activity.seasons('dexter', 1).activity.class ).to eql(Array)
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    it '#shows' do
         | 
| 28 | 
            +
                      expect( @trakt.activity.shows('dexter').activity.class ).to eql(Array)
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    it '#user' do
         | 
| 32 | 
            +
                      expect( @trakt.activity.user('traktr').activity.class ).to eql(Array)
         | 
| 33 | 
            +
                      expect( @trakt.activity.user('joe.lanford').status ).to eql("error")
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  context 'with invalid query' do
         | 
| 38 | 
            +
                    it '#episodes' do
         | 
| 39 | 
            +
                      expect { @trakt.activity.episodes('blah', 1, 1) }.to raise_error(Traktr::ResponseError)
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    it '#movies' do
         | 
| 43 | 
            +
                      expect { @trakt.activity.movies('blah') }.to raise_error(Traktr::ResponseError)
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    it '#seasons' do
         | 
| 47 | 
            +
                      expect { @trakt.activity.seasons('blah', 1) }.to raise_error(Traktr::ResponseError)
         | 
| 48 | 
            +
                    end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    it '#shows' do
         | 
| 51 | 
            +
                      expect { @trakt.activity.shows('blah') }.to raise_error(Traktr::ResponseError)
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                    it '#user' do
         | 
| 55 | 
            +
                      expect { @trakt.activity.user('aaaaaaaaaaaaaaa') }.to raise_error(Traktr::ResponseError)
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                context 'without valid api_key' do
         | 
| 62 | 
            +
                  before :all do
         | 
| 63 | 
            +
                    @trakt = Traktr::Client.new(nil)
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  it '#community' do
         | 
| 67 | 
            +
                    expect { @trakt.activity.community }.to raise_error(Traktr::ResponseError)
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  it '#episodes' do
         | 
| 71 | 
            +
                    expect { @trakt.activity.episodes('dexter', 1, 1) }.to raise_error(Traktr::ResponseError)
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  it '#movies' do
         | 
| 75 | 
            +
                    expect { @trakt.activity.movies('the-dark-knight-2008') }.to raise_error(Traktr::ResponseError)
         | 
| 76 | 
            +
                  end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                  it '#seasons' do
         | 
| 79 | 
            +
                    expect { @trakt.activity.seasons('dexter', 1) }.to raise_error(Traktr::ResponseError)
         | 
| 80 | 
            +
                  end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                  it '#shows' do
         | 
| 83 | 
            +
                    expect { @trakt.activity.shows('dexter') }.to raise_error(Traktr::ResponseError)
         | 
| 84 | 
            +
                  end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                  it '#user' do
         | 
| 87 | 
            +
                    expect { @trakt.activity.user('traktr') }.to raise_error(Traktr::ResponseError)
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
              end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
              context 'POST methods' do
         | 
| 93 | 
            +
                before :all do
         | 
| 94 | 
            +
                  trakt = Traktr::Client.new(API_KEY)
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                context 'with valid api_key and auth credentials' do
         | 
| 98 | 
            +
                  before :all do
         | 
| 99 | 
            +
                    @trakt = Traktr::Client.new(API_KEY, USERNAME, PASSWORD)
         | 
| 100 | 
            +
                  end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                  it '#friends' do
         | 
| 103 | 
            +
                    expect( @trakt.activity.friends.activity.class ).to eql(Array)
         | 
| 104 | 
            +
                  end
         | 
| 105 | 
            +
                end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                context 'without valid api_key' do
         | 
| 108 | 
            +
                  before :all do
         | 
| 109 | 
            +
                    @trakt = Traktr::Client.new(nil, USERNAME, PASSWORD)
         | 
| 110 | 
            +
                  end
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                  it '#friends' do
         | 
| 113 | 
            +
                    expect { @trakt.activity.friends }.to raise_error(Traktr::ResponseError)
         | 
| 114 | 
            +
                  end
         | 
| 115 | 
            +
                end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                context 'without valid auth credentials' do
         | 
| 118 | 
            +
                  before :all do
         | 
| 119 | 
            +
                    @trakt = Traktr::Client.new(API_KEY)
         | 
| 120 | 
            +
                  end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                  it '#friends' do
         | 
| 123 | 
            +
                    expect { @trakt.activity.friends }.to raise_error(Traktr::ResponseError)
         | 
| 124 | 
            +
                  end
         | 
| 125 | 
            +
                end
         | 
| 126 | 
            +
              end
         | 
| 127 | 
            +
            end
         | 
| @@ -0,0 +1,69 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Traktr::Activity::User do
         | 
| 4 | 
            +
              context 'GET methods' do
         | 
| 5 | 
            +
                context 'with valid api_key' do
         | 
| 6 | 
            +
                  before :all do
         | 
| 7 | 
            +
                    @trakt = Traktr::Client.new(API_KEY)
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  context 'with valid query' do
         | 
| 11 | 
            +
                    it '#episodes' do
         | 
| 12 | 
            +
                      expect( @trakt.activity.user.episodes('traktr', 'dexter', 1, 1).activity.class ).to eql(Array)
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    it '#movies' do
         | 
| 16 | 
            +
                      expect( @trakt.activity.user.movies('traktr', 'the-dark-knight-2008').activity.class ).to eql(Array)
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    it '#seasons' do
         | 
| 20 | 
            +
                      expect( @trakt.activity.user.seasons('traktr', 'dexter', 1).activity.class ).to eql(Array)
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    it '#shows' do
         | 
| 24 | 
            +
                      expect( @trakt.activity.user.shows('traktr', 'dexter').activity.class ).to eql(Array)
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  context 'with invalid query' do
         | 
| 29 | 
            +
                    it '#episodes' do
         | 
| 30 | 
            +
                      expect { @trakt.activity.user.episodes('traktr', 'blah', 1, 1) }.to raise_error(Traktr::ResponseError)
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                    it '#movies' do
         | 
| 34 | 
            +
                      expect { @trakt.activity.user.movies('traktr', 'blah') }.to raise_error(Traktr::ResponseError)
         | 
| 35 | 
            +
                    end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                    it '#seasons' do
         | 
| 38 | 
            +
                      expect { @trakt.activity.user.seasons('traktr', 'blah', 1) }.to raise_error(Traktr::ResponseError)
         | 
| 39 | 
            +
                    end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                    it '#shows' do
         | 
| 42 | 
            +
                      expect { @trakt.activity.user.shows('traktr', 'blah') }.to raise_error(Traktr::ResponseError)
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                context 'without valid api_key' do
         | 
| 48 | 
            +
                  before :all do
         | 
| 49 | 
            +
                    @trakt = Traktr::Client.new(nil)
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                  it '#episodes' do
         | 
| 53 | 
            +
                    expect { @trakt.activity.user.episodes('traktr', 'dexter', 1, 1) }.to raise_error(Traktr::ResponseError)
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                  it '#movies' do
         | 
| 57 | 
            +
                    expect { @trakt.activity.user.movies('traktr', 'the-dark-knight-2008') }.to raise_error(Traktr::ResponseError)
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  it '#seasons' do
         | 
| 61 | 
            +
                    expect { @trakt.activity.user.seasons('traktr', 'dexter', 1) }.to raise_error(Traktr::ResponseError)
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  it '#shows' do
         | 
| 65 | 
            +
                    expect { @trakt.activity.user.shows('traktr', 'dexter') }.to raise_error(Traktr::ResponseError)
         | 
| 66 | 
            +
                  end
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
              end
         | 
| 69 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -6,9 +6,15 @@ end | |
| 6 6 |  | 
| 7 7 | 
             
            require 'traktr'
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 9 | 
            +
            if File.exist?(File.join(File.dirname(__FILE__), "spec.yaml"))
         | 
| 10 | 
            +
              config   = YAML.load_file(File.join(File.dirname(__FILE__), "spec.yaml"))
         | 
| 11 | 
            +
              API_KEY  = config["api_key"]
         | 
| 12 | 
            +
              USERNAME = config["username"]
         | 
| 13 | 
            +
              PASSWORD = config["password"]
         | 
| 14 | 
            +
            else
         | 
| 15 | 
            +
              $stderr.puts "ERROR: You must configure the 'spec.yaml' file in the spec directory!"
         | 
| 16 | 
            +
              exit 1
         | 
| 17 | 
            +
            end
         | 
| 12 18 |  | 
| 13 19 | 
             
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         | 
| 14 20 | 
             
            RSpec.configure do |config|
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: traktr
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Joe Lanford
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-03-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httparty
         | 
| @@ -28,70 +28,70 @@ dependencies: | |
| 28 28 | 
             
              name: mash
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - -  | 
| 31 | 
            +
                - - ">="
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: '0'
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - -  | 
| 38 | 
            +
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: bundler
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - - ~>
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: '1.3'
         | 
| 48 48 | 
             
              type: :development
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - - ~>
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '1.3'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: rake
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 59 | 
            +
                - - ">="
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 61 | 
             
                    version: '0'
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 | 
            -
                - -  | 
| 66 | 
            +
                - - ">="
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: rspec
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 | 
            -
                - -  | 
| 73 | 
            +
                - - ">="
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 75 | 
             
                    version: '0'
         | 
| 76 76 | 
             
              type: :development
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 | 
            -
                - -  | 
| 80 | 
            +
                - - ">="
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 82 | 
             
                    version: '0'
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 84 | 
             
              name: simplecov
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 86 | 
             
                requirements:
         | 
| 87 | 
            -
                - -  | 
| 87 | 
            +
                - - ">="
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 89 | 
             
                    version: '0'
         | 
| 90 90 | 
             
              type: :development
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 93 | 
             
                requirements:
         | 
| 94 | 
            -
                - -  | 
| 94 | 
            +
                - - ">="
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '0'
         | 
| 97 97 | 
             
            description: Implementation of the trakt.tv REST API.  See the documentation at http://trakt.tv/api-docs
         | 
| @@ -101,14 +101,16 @@ executables: [] | |
| 101 101 | 
             
            extensions: []
         | 
| 102 102 | 
             
            extra_rdoc_files: []
         | 
| 103 103 | 
             
            files:
         | 
| 104 | 
            -
            - .gitignore
         | 
| 105 | 
            -
            - .rspec
         | 
| 104 | 
            +
            - ".gitignore"
         | 
| 105 | 
            +
            - ".rspec"
         | 
| 106 106 | 
             
            - Gemfile
         | 
| 107 107 | 
             
            - LICENSE.txt
         | 
| 108 108 | 
             
            - README.md
         | 
| 109 109 | 
             
            - Rakefile
         | 
| 110 110 | 
             
            - lib/traktr.rb
         | 
| 111 111 | 
             
            - lib/traktr/account.rb
         | 
| 112 | 
            +
            - lib/traktr/activity.rb
         | 
| 113 | 
            +
            - lib/traktr/activity/user.rb
         | 
| 112 114 | 
             
            - lib/traktr/client.rb
         | 
| 113 115 | 
             
            - lib/traktr/movie.rb
         | 
| 114 116 | 
             
            - lib/traktr/movies.rb
         | 
| @@ -127,7 +129,10 @@ files: | |
| 127 129 | 
             
            - lib/traktr/user/ratings.rb
         | 
| 128 130 | 
             
            - lib/traktr/user/watchlist.rb
         | 
| 129 131 | 
             
            - lib/traktr/version.rb
         | 
| 132 | 
            +
            - spec/.gitignore
         | 
| 130 133 | 
             
            - spec/account_spec.rb
         | 
| 134 | 
            +
            - spec/activity_spec.rb
         | 
| 135 | 
            +
            - spec/activity_user_spec.rb
         | 
| 131 136 | 
             
            - spec/movie_spec.rb
         | 
| 132 137 | 
             
            - spec/movies_spec.rb
         | 
| 133 138 | 
             
            - spec/search_spec.rb
         | 
| @@ -135,6 +140,7 @@ files: | |
| 135 140 | 
             
            - spec/show_season_spec.rb
         | 
| 136 141 | 
             
            - spec/show_spec.rb
         | 
| 137 142 | 
             
            - spec/shows_spec.rb
         | 
| 143 | 
            +
            - spec/spec.yaml.sample
         | 
| 138 144 | 
             
            - spec/spec_helper.rb
         | 
| 139 145 | 
             
            - traktr.gemspec
         | 
| 140 146 | 
             
            homepage: https://github.com/joelanford/traktr
         | 
| @@ -147,22 +153,25 @@ require_paths: | |
| 147 153 | 
             
            - lib
         | 
| 148 154 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 149 155 | 
             
              requirements:
         | 
| 150 | 
            -
              - -  | 
| 156 | 
            +
              - - ">="
         | 
| 151 157 | 
             
                - !ruby/object:Gem::Version
         | 
| 152 158 | 
             
                  version: '0'
         | 
| 153 159 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 154 160 | 
             
              requirements:
         | 
| 155 | 
            -
              - -  | 
| 161 | 
            +
              - - ">="
         | 
| 156 162 | 
             
                - !ruby/object:Gem::Version
         | 
| 157 163 | 
             
                  version: '0'
         | 
| 158 164 | 
             
            requirements: []
         | 
| 159 165 | 
             
            rubyforge_project: 
         | 
| 160 | 
            -
            rubygems_version: 2.1. | 
| 166 | 
            +
            rubygems_version: 2.1.11
         | 
| 161 167 | 
             
            signing_key: 
         | 
| 162 168 | 
             
            specification_version: 4
         | 
| 163 169 | 
             
            summary: Implementation of the trakt.tv REST API
         | 
| 164 170 | 
             
            test_files:
         | 
| 171 | 
            +
            - spec/.gitignore
         | 
| 165 172 | 
             
            - spec/account_spec.rb
         | 
| 173 | 
            +
            - spec/activity_spec.rb
         | 
| 174 | 
            +
            - spec/activity_user_spec.rb
         | 
| 166 175 | 
             
            - spec/movie_spec.rb
         | 
| 167 176 | 
             
            - spec/movies_spec.rb
         | 
| 168 177 | 
             
            - spec/search_spec.rb
         | 
| @@ -170,5 +179,5 @@ test_files: | |
| 170 179 | 
             
            - spec/show_season_spec.rb
         | 
| 171 180 | 
             
            - spec/show_spec.rb
         | 
| 172 181 | 
             
            - spec/shows_spec.rb
         | 
| 182 | 
            +
            - spec/spec.yaml.sample
         | 
| 173 183 | 
             
            - spec/spec_helper.rb
         | 
| 174 | 
            -
            has_rdoc: 
         |