decathlon-sports 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41ca18ce970a10546b8033af4b186c47d479a00e91fe7725ce814acb4827ee47
4
- data.tar.gz: 1d175742ba6fd76e15f2fc152800b6c2b1d855f93be8488b7ec3a8179d7a02fd
3
+ metadata.gz: e4c629b9376d93e6a375ffe8c2720090b2243d582b77ad72b805b267707e37ad
4
+ data.tar.gz: cda252fa54b05f826ba1fa693e77b9c6d60d5260d3acec166940c1a398a392b9
5
5
  SHA512:
6
- metadata.gz: 449a444cc4d4b6b71a0e8e1165aaa655329cb98b63bc65dab45b64eb3a4a0472de01f3dd7c60c2a10959250e615aa8cd983578c6bd44022c972ee3a35e593fc3
7
- data.tar.gz: 55d8d8e338dfd2e69531ceaf4024b6bd21ebb5f5de225c21e71c45211e34fc8b8f38ce726b10ee7f4e574a960f440d49df5d0ac0bdf7dfcba1fb0b57a7b07619
6
+ metadata.gz: f3fa2cf26356ef14b024f69216c4bd0d99367fd009115018908b2be81aefacf58f25d4f0722f3a8a057777d86db935cc876f8313264ae11fe4b219fe280e86aa
7
+ data.tar.gz: aa06e029ead6da2e737e2b50bf3f6f08b01c280d930f5e6cc5d4836d50845ec43ecff1cc922eedf136df49fd7bf07c63ec2f9882e8bb6bb8147cd0f6d3385530
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decathlon-sports (0.1.6)
4
+ decathlon-sports (0.2.0)
5
5
  faraday (~> 0.15.3)
6
6
  json (~> 2.1.0)
7
7
 
@@ -5,45 +5,33 @@ API_URL = 'https://sports.api.decathlon.com'.freeze
5
5
 
6
6
  module Decathlon
7
7
  module Sports
8
- def self.all
9
- call "#{API_URL}/sports"
8
+ def self.call(url: API_URL, params: {}, headers: {})
9
+ response = Faraday.get(url, params, headers)
10
+ JSON.parse(response.body)
10
11
  end
11
12
 
12
- def self.find(id)
13
- call "#{API_URL}/sports/#{id}"
13
+ def self.all(url: "#{API_URL}/sports", params: {}, headers: {})
14
+ call(url: url, params: params, headers: headers)
14
15
  end
15
16
 
16
- def self.search(name)
17
- response = Faraday.get("#{API_URL}/sports?q=#{name}")
18
- JSON.parse(response.body)
17
+ def self.find(id, params: {}, headers: {})
18
+ call(url: "#{API_URL}/sports/#{id}", params: params, headers: headers)
19
19
  end
20
20
 
21
- def self.isearch(name)
22
- response = Faraday.get("#{API_URL}/sports/search/#{name}")
23
- JSON.parse(response.body)
21
+ def self.search(query, params: {}, headers: {})
22
+ call(url: "#{API_URL}/sports?q=#{query}", params: params, headers: headers)
24
23
  end
25
24
 
26
- def self.call(url)
27
- response = Faraday.get(url)
28
- JSON.parse(response.body)
29
- end
30
-
31
- def self.filter(**args)
32
- response = Faraday.get do |req|
33
- req.url "#{API_URL}/sports"
34
- req.params['tag'] = args[:tag] if args[:tag]
35
- req.params['decathlon_id'] = args[:decathlon_id] if args[:decathlon_id]
36
- req.params['parents_only'] = args[:parents_only] if args[:parents_only]
37
- end
38
- JSON.parse(response.body)
25
+ def self.isearch(query, params: {}, headers: {})
26
+ call(url: "#{API_URL}/sports/search/#{query}", params: params, headers: headers)
39
27
  end
40
28
 
41
29
  def groups
42
- call "#{API_URL}/groups"
30
+ call(url: "#{API_URL}/groups")
43
31
  end
44
32
 
45
33
  def group(id)
46
- call "#{API_URL}/groups/#{id}"
34
+ call(url: "#{API_URL}/groups/#{id}")
47
35
  end
48
36
  end
49
37
  end
@@ -1,5 +1,5 @@
1
1
  module Decathlon
2
2
  module Sports
3
- VERSION = '0.1.6'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decathlon-sports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Decathlon Canada
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-07-12 00:00:00.000000000 Z
12
+ date: 2019-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler