taproot 0.1.2 → 0.1.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 +4 -4
- data/lib/taproot.rb +15 -0
- data/taproot.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1458fb1089952f725890523d91259a1c5cf814a9
|
4
|
+
data.tar.gz: c0cd21336a15c50f075418630e42b363d2f7a978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da6748f6f6e33408598c9182f5d6c8a52b61ced1aabd3aaf1ca6c4a33d3318650f9afc2722d2fc7399134ea9ac535edaa37876b725bd393a6045929031a6a1f0
|
7
|
+
data.tar.gz: 5ec9574d441b490a3bbdb86d1cfaaf00cf8e08563d54102ab084d7264a0487fcd4dd044a8d969df4d094db8937aeab1eb3fadf197111a4ae3bda628c7ab00a98
|
data/lib/taproot.rb
CHANGED
@@ -47,6 +47,8 @@ class Taproot < Sinatra::Base
|
|
47
47
|
:id => params[:customer_id]
|
48
48
|
)
|
49
49
|
|
50
|
+
content_type :json
|
51
|
+
|
50
52
|
if result.success?
|
51
53
|
status 201
|
52
54
|
JSON.pretty_generate(:message => "Customer #{params[:customer_id]} created")
|
@@ -152,6 +154,19 @@ class Taproot < Sinatra::Base
|
|
152
154
|
JSON.pretty_generate(:message => CONFIG_MANAGER.validate_environment!)
|
153
155
|
end
|
154
156
|
|
157
|
+
error do
|
158
|
+
content_type :json
|
159
|
+
status 400 # or whatever
|
160
|
+
|
161
|
+
e = env['sinatra.error']
|
162
|
+
JSON.pretty_generate({:result => 'error', :message => e.message})
|
163
|
+
end
|
164
|
+
|
165
|
+
not_found do
|
166
|
+
content_type :json
|
167
|
+
JSON.pretty_generate({:message => "Not found. GET / to see all routes"})
|
168
|
+
end
|
169
|
+
|
155
170
|
after do
|
156
171
|
puts "#{bold ">>>"} #{request.env["REQUEST_METHOD"]} #{request.path} #{params.inspect}"
|
157
172
|
puts "#{green bold "<<<"} #{_color_status(response.status.to_i)}"
|
data/taproot.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "taproot"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "0.1.
|
15
|
+
gem.version = "0.1.3"
|
16
16
|
|
17
17
|
gem.add_dependency "sinatra", "~> 1.4.5"
|
18
18
|
gem.add_dependency "braintree", "~> 2.30.2"
|