luchadeer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +29 -33
- data/lib/luchadeer.rb +0 -12
- data/lib/luchadeer/api.rb +42 -22
- data/lib/luchadeer/client.rb +2 -2
- data/lib/luchadeer/error.rb +4 -11
- data/lib/luchadeer/resource.rb +14 -2
- data/lib/luchadeer/resources.rb +135 -0
- data/lib/luchadeer/search.rb +1 -9
- data/lib/luchadeer/version.rb +1 -1
- data/spec/luchadeer/resources_spec.rb +6 -0
- data/spec/luchadeer_spec.rb +3 -6
- data/spec/spec_helper.rb +3 -0
- data/spec/support/shared_resource.rb +40 -0
- data/spec/support/shared_searchable.rb +65 -0
- metadata +11 -57
- data/lib/luchadeer/api/characters.rb +0 -11
- data/lib/luchadeer/api/companies.rb +0 -11
- data/lib/luchadeer/api/concepts.rb +0 -11
- data/lib/luchadeer/api/franchises.rb +0 -11
- data/lib/luchadeer/api/games.rb +0 -11
- data/lib/luchadeer/api/locations.rb +0 -11
- data/lib/luchadeer/api/objects.rb +0 -11
- data/lib/luchadeer/api/people.rb +0 -11
- data/lib/luchadeer/api/videos.rb +0 -11
- data/lib/luchadeer/character.rb +0 -13
- data/lib/luchadeer/company.rb +0 -13
- data/lib/luchadeer/concept.rb +0 -13
- data/lib/luchadeer/franchise.rb +0 -13
- data/lib/luchadeer/game.rb +0 -13
- data/lib/luchadeer/location.rb +0 -13
- data/lib/luchadeer/object.rb +0 -13
- data/lib/luchadeer/person.rb +0 -13
- data/lib/luchadeer/video.rb +0 -13
- data/spec/luchadeer/api/characters_spec.rb +0 -28
- data/spec/luchadeer/api/companies_spec.rb +0 -28
- data/spec/luchadeer/api/concepts_spec.rb +0 -28
- data/spec/luchadeer/api/franchises_spec.rb +0 -28
- data/spec/luchadeer/api/games_spec.rb +0 -28
- data/spec/luchadeer/api/locations_spec.rb +0 -28
- data/spec/luchadeer/api/objects_spec.rb +0 -28
- data/spec/luchadeer/api/people_spec.rb +0 -28
- data/spec/luchadeer/api/videos_spec.rb +0 -28
- data/spec/luchadeer/character_spec.rb +0 -27
- data/spec/luchadeer/company_spec.rb +0 -27
- data/spec/luchadeer/concept_spec.rb +0 -27
- data/spec/luchadeer/franchise_spec.rb +0 -27
- data/spec/luchadeer/game_spec.rb +0 -27
- data/spec/luchadeer/location_spec.rb +0 -27
- data/spec/luchadeer/object_spec.rb +0 -27
- data/spec/luchadeer/person_spec.rb +0 -27
- data/spec/luchadeer/video_spec.rb +0 -27
data/lib/luchadeer/location.rb
DELETED
data/lib/luchadeer/object.rb
DELETED
data/lib/luchadeer/person.rb
DELETED
data/lib/luchadeer/video.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Characters do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#characters' do
|
7
|
-
let(:character_id) { 1 }
|
8
|
-
let(:character_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/character/3005-#{character_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, character_path).to_return(body: '{ }')
|
12
|
-
client.character("#{character_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Character' do
|
17
|
-
stub_request(:get, character_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.character("#{character_id}")).to be_instance_of Luchadeer::Character
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, character_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.character("#{character_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Characters do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#companies' do
|
7
|
-
let(:company_id) { 1 }
|
8
|
-
let(:company_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/company/3010-#{company_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, company_path).to_return(body: '{ }')
|
12
|
-
client.company("#{company_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Company' do
|
17
|
-
stub_request(:get, company_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.company("#{company_id}")).to be_instance_of Luchadeer::Company
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, company_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.company("#{company_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Concepts do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#concepts' do
|
7
|
-
let(:concept_id) { 1 }
|
8
|
-
let(:concept_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/concept/3015-#{concept_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, concept_path).to_return(body: '{ }')
|
12
|
-
client.concept("#{concept_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Concept' do
|
17
|
-
stub_request(:get, concept_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.concept("#{concept_id}")).to be_instance_of Luchadeer::Concept
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, concept_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.concept("#{concept_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Franchises do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#games' do
|
7
|
-
let(:franchise_id) { 1 }
|
8
|
-
let(:franchise_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/franchise/3025-#{franchise_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, franchise_path).to_return(body: '{ }')
|
12
|
-
client.franchise("#{franchise_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Franchise' do
|
17
|
-
stub_request(:get, franchise_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.franchise("#{franchise_id}")).to be_instance_of Luchadeer::Franchise
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, franchise_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.franchise("#{franchise_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Games do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#games' do
|
7
|
-
let(:game_id) { 1 }
|
8
|
-
let(:game_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/game/3030-#{game_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, game_path).to_return(body: '{ }')
|
12
|
-
client.game("#{game_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Game' do
|
17
|
-
stub_request(:get, game_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.game("#{game_id}")).to be_instance_of Luchadeer::Game
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, game_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.game("#{game_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Locations do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#Locations' do
|
7
|
-
let(:location_id) { 1 }
|
8
|
-
let(:location_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/location/3035-#{location_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, location_path).to_return(body: '{ }')
|
12
|
-
client.location("#{location_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Location' do
|
17
|
-
stub_request(:get, location_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.location("#{location_id}")).to be_instance_of Luchadeer::Location
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, location_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.location("#{location_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Objects do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#games' do
|
7
|
-
let(:object_id) { 1 }
|
8
|
-
let(:object_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/object/3055-#{object_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, object_path).to_return(body: '{ }')
|
12
|
-
client.object("#{object_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Object' do
|
17
|
-
stub_request(:get, object_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.object("#{object_id}")).to be_instance_of Luchadeer::Object
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, object_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.object("#{object_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::People do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#games' do
|
7
|
-
let(:person_id) { 1 }
|
8
|
-
let(:person_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/person/3040-#{person_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, person_path).to_return(body: '{ }')
|
12
|
-
client.person("#{person_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Object' do
|
17
|
-
stub_request(:get, person_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.person("#{person_id}")).to be_instance_of Luchadeer::Person
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, person_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.person("#{person_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::API::Videos do
|
4
|
-
let(:client) { Luchadeer::Client.new }
|
5
|
-
|
6
|
-
describe '#games' do
|
7
|
-
let(:video_id) { 1 }
|
8
|
-
let(:video_path) { %r(#{Luchadeer::Client::GIANT_BOMB}/video/2300-#{video_id}) }
|
9
|
-
|
10
|
-
it 'requests the right url' do
|
11
|
-
stub = stub_request(:get, video_path).to_return(body: '{ }')
|
12
|
-
client.video("#{video_id}")
|
13
|
-
expect(stub).to have_been_requested
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns a Luchadeer::Object' do
|
17
|
-
stub_request(:get, video_path).to_return(body: '{ "results": { "key": "value"}}')
|
18
|
-
expect(client.video("#{video_id}")).to be_instance_of Luchadeer::Video
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'caches responses' do
|
22
|
-
stub_request(:get, video_path).to_return(body: '{ }')
|
23
|
-
expect(client).to receive :cache
|
24
|
-
client.video("#{video_id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::Character do
|
4
|
-
|
5
|
-
it 'is a resource' do
|
6
|
-
expect(described_class.new).to be_a Luchadeer::Resource
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '.find' do
|
10
|
-
let(:client) { Luchadeer::Client.new }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
Luchadeer.client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'forwards to Client#character with arguments' do
|
17
|
-
expect(client).to receive(:character).with(1, true)
|
18
|
-
described_class.find(1, true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'forwards to Client#character with default refresh' do
|
22
|
-
expect(client).to receive(:character).with(1, false)
|
23
|
-
described_class.find(1)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::Company do
|
4
|
-
|
5
|
-
it 'is a resource' do
|
6
|
-
expect(described_class.new).to be_a Luchadeer::Resource
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '.find' do
|
10
|
-
let(:client) { Luchadeer::Client.new }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
Luchadeer.client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'forwards to Client#company with arguments' do
|
17
|
-
expect(client).to receive(:company).with(1, true)
|
18
|
-
described_class.find(1, true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'forwards to Client#company with default refresh' do
|
22
|
-
expect(client).to receive(:company).with(1, false)
|
23
|
-
described_class.find(1)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::Concept do
|
4
|
-
|
5
|
-
it 'is a resource' do
|
6
|
-
expect(described_class.new).to be_a Luchadeer::Resource
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '.find' do
|
10
|
-
let(:client) { Luchadeer::Client.new }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
Luchadeer.client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'forwards to Client#concept with arguments' do
|
17
|
-
expect(client).to receive(:concept).with(1, true)
|
18
|
-
described_class.find(1, true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'forwards to Client#concept with default refresh' do
|
22
|
-
expect(client).to receive(:concept).with(1, false)
|
23
|
-
described_class.find(1)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::Franchise do
|
4
|
-
|
5
|
-
it 'is a resource' do
|
6
|
-
expect(described_class.new).to be_a Luchadeer::Resource
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '.find' do
|
10
|
-
let(:client) { Luchadeer::Client.new }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
Luchadeer.client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'forwards to Client#franchise with arguments' do
|
17
|
-
expect(client).to receive(:franchise).with(1, true)
|
18
|
-
described_class.find(1, true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'forwards to Client#franchise with default refresh' do
|
22
|
-
expect(client).to receive(:franchise).with(1, false)
|
23
|
-
described_class.find(1)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/spec/luchadeer/game_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Luchadeer::Game do
|
4
|
-
|
5
|
-
it 'is a resource' do
|
6
|
-
expect(described_class.new).to be_a Luchadeer::Resource
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '.find' do
|
10
|
-
let(:client) { Luchadeer::Client.new }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
Luchadeer.client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'forwards to Client#game with arguments' do
|
17
|
-
expect(client).to receive(:game).with(1, true)
|
18
|
-
described_class.find(1, true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'forwards to Client#game with default refresh' do
|
22
|
-
expect(client).to receive(:game).with(1, false)
|
23
|
-
described_class.find(1)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|