igdb2 0.8.0 → 0.8.1

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: 69b27188f6559dbed98d21041334bf8e110fdf857f1e56f020508fd8008efd02
4
- data.tar.gz: df7d26cd5a96c70974999031bb2481571fc6a737e7eaecd51b9aba47bbee5747
3
+ metadata.gz: c3ac7c5fecdedab89a8d6a7f9e8f669eeec539fcf6b21d27265fa99b674f896b
4
+ data.tar.gz: 4ce83900cc09f6201f59bf718a7bbcb148aeb999d9a91a88c106feff5d6221a5
5
5
  SHA512:
6
- metadata.gz: 8f41bc2879a91637689edd54789e9f947e1e5db5daf827035d1da60f7e08ec63f87001497d6cd1f95b016ad1ba13203edce7f39ddbe10c66c7a8017734c0440a
7
- data.tar.gz: ae12f2121d43232f1a5f46272fccd421c3a07203a977181e8114e989459e8744fb4eac440a5226f3232ec6667f54c9518deb2f28d7b80f3dd5dca02430c1da7b
6
+ metadata.gz: b20b6784ed636c7ec3a9ba258e74a1e1b1c28449e85ad9cbb6a71d7fc3775e0f5d4f5b79a2e9ef7d01f8f7995723fee52c36f8ed580333744adc84e4a3d66152
7
+ data.tar.gz: b7d3eb0dbb84d07d002e8a612641a0d1fc329bf642d404e6c02b2e5a4cd9c18b9d967f07eca1c3c280c4d59cff67c444d1c76e3d6dfbd60aac511eca08cae058
@@ -14,43 +14,34 @@ module Igdb
14
14
  Igdb::Requester.get("#{path}/meta")
15
15
  end
16
16
 
17
- def find(id, options = {})
18
- params = options
19
- params[:fields] = '*' unless params[:fields]
17
+ def find(id, **kwargs)
18
+ kwargs[:fields] = kwargs[:fields] || '*'
20
19
 
21
20
  if id.class == Array
22
- build_collection(Igdb::Requester.get("#{path}/#{id.join(',')}", params), representer)
21
+ build_collection(Igdb::Requester.get("#{path}/#{id.join(',')}", kwargs), representer)
23
22
  else
24
- build_single_resource(Igdb::Requester.get("#{path}/#{id}", params)[0], representer)
23
+ build_single_resource(Igdb::Requester.get("#{path}/#{id}", kwargs)[0], representer)
25
24
  end
26
25
  end
27
26
 
28
- def slug(id, options = {})
29
- params = options
30
- params['fields'] = '*' unless params[:fields]
31
- params['filter[slug][eq]'] = id
27
+ def slug(id, **kwargs)
28
+ kwargs[:fields] = kwargs[:fields] || '*'
29
+ kwargs[:'filter[slug][eq]'] = id
32
30
 
33
- build_single_resource(Igdb::Requester.get("#{path}/", params)[0], representer)
31
+ build_single_resource(Igdb::Requester.get("#{path}/", kwargs)[0], representer)
34
32
  end
35
33
 
36
- def search(opts = {})
37
- params = {}.tap do |hash|
38
- hash['search'] = opts[:query] if opts[:query]
39
- hash['filters'] = opts[:filters] if opts[:filters]
40
- hash['fields'] = '*'
41
- end
34
+ def search(**kwargs)
35
+ kwargs[:offset] = kwargs[:offset] || 0
36
+ kwargs[:limit] = kwargs[:limit] || 50
37
+ kwargs[:fields] = kwargs[:fields] || '*'
42
38
 
43
- build_collection(Igdb::Requester.get("#{path}/", params), representer)
39
+ build_collection(Igdb::Requester.get("#{path}/", kwargs), representer)
44
40
  end
45
41
 
46
- def all(opts = {})
47
- params = {}.tap do |hash|
48
- hash['offset'] = opts[:offset] || 0
49
- hash['limit'] = opts[:limit] || 50
50
- hash['fields'] = '*'
51
- end
52
-
53
- build_collection(Igdb::Requester.get("#{path}/", opts), representer)
42
+ # Alias for #search
43
+ def all(**kwargs)
44
+ search(kwargs)
54
45
  end
55
46
 
56
47
  private
@@ -1,3 +1,3 @@
1
1
  module Igdb
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.8.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: igdb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalyn Robinson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler