recharge-api 0.0.2 → 0.0.3

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: 9f3a7eb0f67af92f82030c6051b89285c6b12a0e6eeb6d959d0b3ce9ca467c62
4
- data.tar.gz: 2ee8e765979f5b691ac980e9a4cc691069e6bfe1b672d36ddd0a816ecaaabed8
3
+ metadata.gz: ee32838fa8398e204bc218649237bc6fcee7eb009990fbbf336f997a61064d0c
4
+ data.tar.gz: e94209a8e1a5fe6c75ce23671d69e3bb0b86cf9d71ee8e5fd16969ddfdcf79d3
5
5
  SHA512:
6
- metadata.gz: 6ea64a155cd959427bf2e7cc39c2e657ee9e42915a13639b26fc58146b4a061c489d92dfdca43dd6e8266be6ef6c47a600e67522f9a1a973c9eea73999565024
7
- data.tar.gz: ec422be602cb58ac9272bb70bee0a53a4423f94986c9fed5a1626c6e0e6c8db988cf02db64a9eb2563b5857c86c8874b681117a24a840e46bbc21aa0de7a661e
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
- # Gemfile.lock
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
@@ -262,7 +262,7 @@ class2 "Recharge", JSON.parse(<<-END) do
262
262
  "discount":{
263
263
  "id": 3748296,
264
264
  "code": "Discount1",
265
- "value": 12,
265
+ "value": 12.5,
266
266
  "ends_at": "2019-12-15T00:00:00",
267
267
  "starts_at": "2018-05-16T00:00:00",
268
268
  "status": "enabled",
@@ -64,7 +64,18 @@ module Recharge
64
64
  req["Content-Type"] = "application/json"
65
65
  end
66
66
 
67
- connection.start do |http|
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
@@ -1,3 +1,3 @@
1
1
  module Recharge
2
- VERSION = "0.0.2".freeze
2
+ VERSION = "0.0.3".freeze
3
3
  end
@@ -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.2
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-05-06 00:00:00.000000000 Z
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: