decathlon-sports 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +5 -0
- data/lib/decathlon/sports/sport.rb +26 -5
- data/lib/decathlon/sports/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83c5b9fb9c30ab0bcbccff92d750ce7458069d027a0e3894a203aa78447bc9d6
|
4
|
+
data.tar.gz: 5170bde54322c0f88ba255a75a6bb8f7d52525660578e18d51d5f46bc1bb2118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8157a40cd03453f294644949d5ac6c1c2340d2b0e2e39dfde9c55bd2120303bab3bbca7dbab46afbe1f1128c481b1eafe91e2805046f675d1a70eb38d5ad30ad
|
7
|
+
data.tar.gz: ba7600138b3b105d6b2861a62878d4fcbc72498df5c3e6ff1f6ba25fc7c45b7f9b09c4e6640148638d37638247517d2540328d9178c2ab0ca0527046b146e154
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,11 @@ sports = Decathlon::Sports.all
|
|
30
30
|
sport = Decathlon::Sports.find(175)
|
31
31
|
```
|
32
32
|
|
33
|
+
### Decathlon::Sports.search
|
34
|
+
```ruby
|
35
|
+
sport = Decathlon::Sports.search('Snowboarding')
|
36
|
+
```
|
37
|
+
|
33
38
|
### Decathlon::Sports::Recommendations.get
|
34
39
|
```ruby
|
35
40
|
recommendations = Decathlon::Sports::Recommendations.get(175)
|
@@ -1,23 +1,44 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
API_URL = 'https://sports
|
4
|
+
API_URL = 'https://sports.api.decathlon.com'.freeze
|
5
5
|
|
6
6
|
module Decathlon
|
7
7
|
module Sports
|
8
8
|
def self.all
|
9
|
-
|
10
|
-
JSON.parse(response.body)
|
9
|
+
call "#{API_URL}/sports"
|
11
10
|
end
|
12
11
|
|
13
12
|
def self.find(id)
|
14
|
-
|
15
|
-
JSON.parse(response.body)
|
13
|
+
call "#{API_URL}/sports/#{id}"
|
16
14
|
end
|
17
15
|
|
18
16
|
def self.search(name)
|
19
17
|
response = Faraday.get("#{API_URL}/sports?q=#{name}")
|
20
18
|
JSON.parse(response.body)
|
21
19
|
end
|
20
|
+
|
21
|
+
def self.call(url)
|
22
|
+
response = Faraday.get(url)
|
23
|
+
JSON.parse(response.body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.filter(**args)
|
27
|
+
response = Faraday.get do |req|
|
28
|
+
req.url "#{API_URL}/sports"
|
29
|
+
req.params['tag'] = args[:tag] if args[:tag]
|
30
|
+
req.params['decathlon_id'] = args[:decathlon_id] if args[:decathlon_id]
|
31
|
+
req.params['parents_only'] = args[:parents_only] if args[:parents_only]
|
32
|
+
end
|
33
|
+
JSON.parse(response.body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def groups
|
37
|
+
call "#{API_URL}/groups"
|
38
|
+
end
|
39
|
+
|
40
|
+
def group(id)
|
41
|
+
call "#{API_URL}/groups/#{id}"
|
42
|
+
end
|
22
43
|
end
|
23
44
|
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.
|
4
|
+
version: 0.1.4
|
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-
|
12
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -127,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
|
131
|
-
rubygems_version: 2.7.6
|
130
|
+
rubygems_version: 3.0.1
|
132
131
|
signing_key:
|
133
132
|
specification_version: 4
|
134
133
|
summary: Gem to wrap the Decathlon Sports API
|