giantbomb 0.0.1 → 0.0.2
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.
- data/lib/giantbomb.rb +2 -2
- data/lib/giantbomb/company.rb +73 -0
- metadata +4 -3
data/lib/giantbomb.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'httparty'
|
3
3
|
|
4
|
-
["api", "search", "game"].each do |inc|
|
4
|
+
["api", "search", "game", "company"].each do |inc|
|
5
5
|
require File.join(File.dirname(__FILE__), "giantbomb", inc)
|
6
6
|
end
|
7
7
|
|
8
8
|
module GiantBomb
|
9
|
-
VERSION = "0.0.
|
9
|
+
VERSION = "0.0.2"
|
10
10
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module GiantBomb
|
2
|
+
class Company < Api
|
3
|
+
# http://api.giantbomb.com/documentation/#company
|
4
|
+
@@fields = [
|
5
|
+
:abbreviation, # Abbreviation of the company
|
6
|
+
:aliases, # List of aliases the company is known by. A \n (newline) separates each alias.
|
7
|
+
:api_detail_url, # URL pointing to the company detail resource
|
8
|
+
:characters, # Characters the company has used in a game
|
9
|
+
:concepts, # Concepts related to the company
|
10
|
+
:date_added, # Date the company was added to Giant Bomb
|
11
|
+
:date_founded, # Date the company was founded
|
12
|
+
:date_last_updated, # Date the company was last updated on Giant Bomb
|
13
|
+
:deck, # Brief summary of the company
|
14
|
+
:description, # Description of the company
|
15
|
+
:developed_games, # Games the company has developed
|
16
|
+
:developer_releases, # Releases the company has developed
|
17
|
+
:distributor_releases, # Releases the company has distributed
|
18
|
+
:id, # Unique ID of the company
|
19
|
+
:image, # Main Image of the company
|
20
|
+
:location_address, # Street address of the company
|
21
|
+
:location_city, # City the company resides in
|
22
|
+
:location_country, # Country the company resides in
|
23
|
+
:location_state, # State the company resides in
|
24
|
+
:locations, # Locations related to the company
|
25
|
+
:name, # Name of the company
|
26
|
+
:objects, # Objects related to the company
|
27
|
+
:people, # People who have worked for the company
|
28
|
+
:phone, # Phone number of the company
|
29
|
+
:published_games, # Games published by the company
|
30
|
+
:publisher_releases, # Releases the company has published
|
31
|
+
:site_detail_url, # URL pointing to the company on Giant Bomb
|
32
|
+
:website # URL to the company website
|
33
|
+
]
|
34
|
+
|
35
|
+
@@fields.each do |field|
|
36
|
+
attr_accessor field
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(attributes={})
|
40
|
+
attributes.each do |key, value|
|
41
|
+
if self.respond_to?(key.to_sym)
|
42
|
+
self.instance_variable_set("@#{key}", value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.detail(id, conditions={})
|
48
|
+
search = GiantBomb::Search.new("/company/#{id}/")
|
49
|
+
search.filter(conditions)
|
50
|
+
Company.new(search.fetch)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.list(conditions={})
|
54
|
+
search = GiantBomb::Search.new("/companies")
|
55
|
+
search.filter(conditions)
|
56
|
+
search.fetch.collect do |result|
|
57
|
+
Company.new(result)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.search(query)
|
62
|
+
search = GiantBomb::Search.new
|
63
|
+
search.resources('company')
|
64
|
+
search.query(query)
|
65
|
+
search.fetch
|
66
|
+
end
|
67
|
+
|
68
|
+
class << self
|
69
|
+
alias_method :find, :search
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giantbomb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robert Coker
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- giantbomb.gemspec
|
37
37
|
- lib/giantbomb.rb
|
38
38
|
- lib/giantbomb/api.rb
|
39
|
+
- lib/giantbomb/company.rb
|
39
40
|
- lib/giantbomb/game.rb
|
40
41
|
- lib/giantbomb/search.rb
|
41
42
|
has_rdoc: true
|