rr_games_radar 1.0.3 → 1.0.4

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.
@@ -24,5 +24,4 @@ Gem::Specification.new do |gem|
24
24
 
25
25
  gem.add_development_dependency('turn', '~> 0.9.6')
26
26
  gem.add_development_dependency('rake', '~> 0.9.2.2')
27
-
28
- end
27
+ end
@@ -15,50 +15,74 @@ module GamesRadarApi
15
15
  def game(id)
16
16
  response = get("/game/#{id}")
17
17
  self.total_rows = response.total_rows.to_i
18
- unless response.game.nil? or response.game.id.nil?
19
- if response.game.name.nil?
20
- response.game.name = nil
21
- elsif response.game.name.include?("us")
22
- response.game.name = response.game.name.us
18
+ game = if response.game.nil? or response.game.id.nil?
19
+ nil
20
+ else
21
+ response.game
22
+ end
23
+
24
+ if !game.nil?
25
+ if game.name.nil?
26
+ game.name = nil
27
+ elsif game.name.include?("us")
28
+ game.name = game.name.us
23
29
  end
24
30
 
25
- if response.game.release_date.nil?
26
- response.game[:release_date] = nil
31
+ if game.release_date.nil?
32
+ game[:release_date] = nil
27
33
  end
28
34
 
29
- if response.game.platform.nil?
30
- response.game[:platform] = nil
31
- elsif response.game.platform.include?("name")
32
- response.game[:platform] = response.game.platform.name
35
+ if game.platform.nil?
36
+ game[:platform] = nil
37
+ elsif game.platform.include?("name")
38
+ game[:platform] = game.platform.name
33
39
  end
34
40
 
35
- if response.game.genre.nil?
36
- response.game[:genre] = nil
37
- elsif response.game.genre.include?("name")
38
- response.game[:genre] = response.game.genre.name
41
+ if game.genre.nil?
42
+ game[:genre] = nil
43
+ elsif game.genre.include?("name")
44
+ game[:genre] = game.genre.name
39
45
  end
40
46
 
41
- if response.game.publishers.nil?
42
- response.game[:publishers] = nil
43
- elsif response.game.publishers.include?("us")
44
- response.game[:publishers] = response.game.publishers.us
47
+ if game.publishers.nil?
48
+ game[:publishers] = nil
49
+ elsif game.publishers.include?("us")
50
+ game[:publishers] = game.publishers.us
45
51
  end
46
52
 
47
- if response.game.description.nil? or response.game.description.empty?
48
- response.game[:description] = nil
53
+ if game.description.nil? or game.description.empty?
54
+ game[:description] = nil
49
55
  else
50
- response.game[:description] = response.game.description
56
+ game[:description] = game.description
51
57
  end
52
58
 
53
- if response.game.censorship.nil?
54
- response.game[:esrb] = nil
59
+ if game.censorship.nil?
60
+ game[:esrb] = nil
55
61
  else
56
- response.game[:esrb] = response.game.censorship.esrb.rating
62
+ game[:esrb] = game.censorship.esrb.rating
63
+ end
64
+
65
+ if game.expected_release_date.nil?
66
+ game.expected_release_date = nil
67
+ elsif game.expected_release_date.include?("us")
68
+ game.expected_release_date = game.expected_release_date.us
57
69
  end
70
+
71
+ if game.developers.nil?
72
+ game.developers = nil
73
+ elsif game.developers.include?("company")
74
+ game.developers = game.developers.company.name
75
+ end
76
+
77
+ if game.publishers.nil?
78
+ game.publishers = nil
79
+ elsif game.publishers.include?("company")
80
+ game.publishers = game.publishers.company.name
81
+ end
82
+
58
83
  end
59
84
 
60
- return response.game unless response.game.nil? or response.game.id.nil?
61
- return nil
85
+ return game
62
86
  end
63
87
 
64
88
  def game_search(query,platform,options={:region=>'us'})
@@ -1,3 +1,3 @@
1
1
  module GamesRadarApi
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -52,6 +52,16 @@ describe GamesRadarApi::Client::Games do
52
52
  response = @client.game('16725')
53
53
  response.esrb.must_equal("Mature")
54
54
  end
55
+
56
+ it "should return name of developers" do
57
+ response = @client.game('16725')
58
+ response.developers.must_equal("SCE Santa Monica")
59
+ end
60
+
61
+ it "should return name of publishers" do
62
+ response = @client.game('16725')
63
+ response.publishers.must_equal("SCEA")
64
+ end
55
65
  end
56
66
 
57
67
  describe 'Game Search' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rr_games_radar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday_middleware