decathlon-https 0.1.1 → 0.1.2
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 +4 -4
- data/lib/decathlon/https.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed30bcfe395a329f0f2217675bd09513bbd0bb378efe99f6f1582ac0a44f0ca8
|
4
|
+
data.tar.gz: a3e8870b643bc8dad06159eaa0f5384a87d6597e5fdae671b30398db51e0f70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e73cfaf5d4a95d4615b31a47dcdbc00ba358eea039c61f26a68863efc1b4eebaf77786c1f10907290603bbd6a9cb5b9ca59961198471a3e17c692c182e85a04
|
7
|
+
data.tar.gz: 478b2e15b2783c79e402636cb5bf8d50f4d5154332d052b490adb050921222f2ab4b91fdf83ac8877edb42a2111d431b98fca3d538273dcedd27fa5d71806680
|
data/lib/decathlon/https.rb
CHANGED
@@ -9,9 +9,9 @@ module Decathlon
|
|
9
9
|
#
|
10
10
|
module HTTPS
|
11
11
|
|
12
|
-
VERSION =
|
12
|
+
VERSION = '0.1.2'
|
13
13
|
|
14
|
-
def self.json_api_request(base_url: '', params: {}, verb: :get, headers: {})
|
14
|
+
def self.json_api_request(base_url: '', params: {}, verb: :get, headers: {}, return_http_status_code: false)
|
15
15
|
|
16
16
|
# Parse URI and build a new HTTPS client
|
17
17
|
#
|
@@ -62,6 +62,10 @@ module Decathlon
|
|
62
62
|
response = http.request(request)
|
63
63
|
code = response.code.to_i
|
64
64
|
body = response.body.to_s
|
65
|
+
|
66
|
+
# Return parsed body content, and status code if requested
|
67
|
+
#
|
68
|
+
return { body: JSON.parse(body, symbolize_names: true), code: code } if return_http_status_code == true
|
65
69
|
return {} if code == 204 || (body.empty? && code < 400)
|
66
70
|
return JSON.parse(body, symbolize_names: true)
|
67
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decathlon-https
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Hayter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
rubygems_version: 3.0.
|
77
|
+
rubygems_version: 3.0.4
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Simple abstraction library for making HTTPS JSON calls
|