recharge-api 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Changes +12 -0
- data/lib/recharge/classes.rb +1 -1
- data/lib/recharge/http_request.rb +12 -18
- data/lib/recharge/version.rb +1 -1
- data/recharge-api.gemspec +6 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee32838fa8398e204bc218649237bc6fcee7eb009990fbbf336f997a61064d0c
|
4
|
+
data.tar.gz: e94209a8e1a5fe6c75ce23671d69e3bb0b86cf9d71ee8e5fd16969ddfdcf79d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46485e00f9c1a8d09c247690d0341cb2a1705716344be6c2c31767d80200dcd5be9ea9a90bc16455924ac7f77910fed8e0d85ad49b7b94f590ee60ce3575e610
|
7
|
+
data.tar.gz: 464b7e93179dabcea1604811a768554dc49c3410c3fc45e3a9835e21e7e7457f746d93363ead0a21e36167e3f6396a3d8ee74d52b6b93c3111083f29357aebaa
|
data/.gitignore
CHANGED
@@ -112,7 +112,7 @@ build-iPhoneSimulator/
|
|
112
112
|
|
113
113
|
# for a library or gem, you might want to ignore these files since the code is
|
114
114
|
# intended to run in multiple environments; otherwise, check them in:
|
115
|
-
|
115
|
+
Gemfile.lock
|
116
116
|
# .ruby-version
|
117
117
|
# .ruby-gemset
|
118
118
|
|
data/Changes
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
2020-11-27 v0.0.3
|
2
|
+
--------------------
|
3
|
+
* Fix HTTP requests so that they're thread-safe
|
4
|
+
* Fix Discount#value; it's a Float not an Integer
|
5
|
+
|
6
|
+
2020-05-05 v0.0.2
|
7
|
+
--------------------
|
8
|
+
* Fix for HTTP 204 responses
|
9
|
+
* Add support for Metafield
|
10
|
+
* Add limited support for Product and Discount
|
11
|
+
* Add additional properties to Subscription and Charge
|
12
|
+
* Add support for setting the API key via the RECHARGE_API_KEY env var
|
data/lib/recharge/classes.rb
CHANGED
@@ -64,7 +64,18 @@ module Recharge
|
|
64
64
|
req["Content-Type"] = "application/json"
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
request = Net::HTTP.new(ENDPOINT, PORT)
|
68
|
+
request.use_ssl = true
|
69
|
+
|
70
|
+
if !Recharge.debug
|
71
|
+
request.set_debug_output(nil)
|
72
|
+
else
|
73
|
+
request.set_debug_output(
|
74
|
+
Recharge.debug.is_a?(IO) ? Recharge.debug : $stderr
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
request.start do |http|
|
68
79
|
res = http.request(req)
|
69
80
|
# API returns 204 but content-type header is set to application/json so check body
|
70
81
|
data = res.body && res["Content-Type"] == "application/json" ? parse_json(res.body) : {}
|
@@ -79,23 +90,6 @@ module Recharge
|
|
79
90
|
raise ConnectionError, "connection failure: #{e}"
|
80
91
|
end
|
81
92
|
|
82
|
-
def connection
|
83
|
-
unless defined? @request
|
84
|
-
@request = Net::HTTP.new(ENDPOINT, PORT)
|
85
|
-
@request.use_ssl = true
|
86
|
-
end
|
87
|
-
|
88
|
-
if !Recharge.debug
|
89
|
-
@request.set_debug_output(nil)
|
90
|
-
else
|
91
|
-
@request.set_debug_output(
|
92
|
-
Recharge.debug.is_a?(IO) ? Recharge.debug : $stderr
|
93
|
-
)
|
94
|
-
end
|
95
|
-
|
96
|
-
@request
|
97
|
-
end
|
98
|
-
|
99
93
|
def parse_json(s)
|
100
94
|
JSON.parse(s)
|
101
95
|
rescue JSON::ParserError => e
|
data/lib/recharge/version.rb
CHANGED
data/recharge-api.gemspec
CHANGED
@@ -18,6 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.bindir = "exe"
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
+
spec.metadata = {
|
22
|
+
"changelog_uri" => "https://github.com/ScreenStaring/recharge-api/blob/master/Changes",
|
23
|
+
"bug_tracker_uri" => "https://github.com/ScreenStaring/recharge-api/issues",
|
24
|
+
"documentation_uri" => "http://rdoc.info/gems/recharge-api",
|
25
|
+
"source_code_uri" => "https://github.com/ScreenStaring/recharge-api",
|
26
|
+
}
|
21
27
|
|
22
28
|
spec.add_dependency "class2", "~> 0.3.0"
|
23
29
|
# Keep this until we can upgrade class2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recharge-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skye Shaw
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: class2
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
91
|
- ".travis.yml"
|
92
|
+
- Changes
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -103,7 +104,11 @@ files:
|
|
103
104
|
homepage: https://github.com/ScreenStaring/recharge-api
|
104
105
|
licenses:
|
105
106
|
- MIT
|
106
|
-
metadata:
|
107
|
+
metadata:
|
108
|
+
changelog_uri: https://github.com/ScreenStaring/recharge-api/blob/master/Changes
|
109
|
+
bug_tracker_uri: https://github.com/ScreenStaring/recharge-api/issues
|
110
|
+
documentation_uri: http://rdoc.info/gems/recharge-api
|
111
|
+
source_code_uri: https://github.com/ScreenStaring/recharge-api
|
107
112
|
post_install_message:
|
108
113
|
rdoc_options: []
|
109
114
|
require_paths:
|