igdb2 0.8.1 → 0.8.2.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3ac7c5fecdedab89a8d6a7f9e8f669eeec539fcf6b21d27265fa99b674f896b
4
- data.tar.gz: 4ce83900cc09f6201f59bf718a7bbcb148aeb999d9a91a88c106feff5d6221a5
3
+ metadata.gz: fb7fde6302199eedb79c20d2dbecf483cf95a0ee84c7f227dc82f37ae660a7f4
4
+ data.tar.gz: '099bb1e04c8fb65202bfa1f037151193be4d8b8d9a39743e2529aebc140d215b'
5
5
  SHA512:
6
- metadata.gz: b20b6784ed636c7ec3a9ba258e74a1e1b1c28449e85ad9cbb6a71d7fc3775e0f5d4f5b79a2e9ef7d01f8f7995723fee52c36f8ed580333744adc84e4a3d66152
7
- data.tar.gz: b7d3eb0dbb84d07d002e8a612641a0d1fc329bf642d404e6c02b2e5a4cd9c18b9d967f07eca1c3c280c4d59cff67c444d1c76e3d6dfbd60aac511eca08cae058
6
+ metadata.gz: 91d646fcbf31985f5786088b1bdec8fd12f5335ce32c0b7d43abd0a6461af2a16583333c0d0f6cf44a5411677d686bf4a16dd40ccc798bcafda4981a7b4114f5
7
+ data.tar.gz: a5a17a47b82954dcc5f30dcd263aa5d8e3ee73496d116aa1cdc704d62bd8f6ad1ad6d0dbf97c843090f4f32e7a53df33565ed2e80e15bf4f734c47ebcdcc2220
@@ -14,38 +14,34 @@ module Igdb
14
14
  Igdb::Requester.get("#{path}/meta")
15
15
  end
16
16
 
17
- def find(id, **kwargs)
18
- kwargs[:fields] = kwargs[:fields] || '*'
17
+ def find(id, **params)
18
+ params[:fields] ||= '*'
19
+ return find_by_slug(id, params) if id.class == String
19
20
 
20
- if id.class == Array
21
- build_collection(Igdb::Requester.get("#{path}/#{id.join(',')}", kwargs), representer)
22
- else
23
- build_single_resource(Igdb::Requester.get("#{path}/#{id}", kwargs)[0], representer)
24
- end
21
+ build_single_resource(Igdb::Requester.get("#{path}/#{id}", params)[0], representer)
25
22
  end
26
23
 
27
- def slug(id, **kwargs)
28
- kwargs[:fields] = kwargs[:fields] || '*'
29
- kwargs[:'filter[slug][eq]'] = id
24
+ def select(*ids, **params)
25
+ params[:fields] ||= '*'
30
26
 
31
- build_single_resource(Igdb::Requester.get("#{path}/", kwargs)[0], representer)
27
+ build_collection(Igdb::Requester.get("#{path}/#{ids.join ','}", params), representer)
32
28
  end
33
29
 
34
- def search(**kwargs)
35
- kwargs[:offset] = kwargs[:offset] || 0
36
- kwargs[:limit] = kwargs[:limit] || 50
37
- kwargs[:fields] = kwargs[:fields] || '*'
30
+ def all(**params)
31
+ params[:fields] ||= '*'
32
+ params[:limit] ||= 50
38
33
 
39
- build_collection(Igdb::Requester.get("#{path}/", kwargs), representer)
40
- end
41
-
42
- # Alias for #search
43
- def all(**kwargs)
44
- search(kwargs)
34
+ build_collection(Igdb::Requester.get("#{path}/", params), representer)
45
35
  end
46
36
 
47
37
  private
48
38
 
39
+ def find_by_slug(slug, params)
40
+ params[:'filter[slug][eq]'] = slug
41
+
42
+ build_single_resource(Igdb::Requester.get("#{path}/", params)[0], representer)
43
+ end
44
+
49
45
  def build_single_resource(response, representer)
50
46
  representer.new(new).from_hash(response)
51
47
  end
@@ -1,3 +1,3 @@
1
1
  module Igdb
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.8.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: igdb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalyn Robinson
@@ -266,9 +266,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
266
  version: '0'
267
267
  required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - ">="
269
+ - - ">"
270
270
  - !ruby/object:Gem::Version
271
- version: '0'
271
+ version: 1.3.1
272
272
  requirements: []
273
273
  rubyforge_project:
274
274
  rubygems_version: 2.7.3