all3dp 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e55f0922f578f56da8e10eb1ff064a19cc81a2a
4
- data.tar.gz: cd7d85a4e838ee3e30918a1d2ec84e341c384fd1
3
+ metadata.gz: 5a6eb4488cb86bdefb5bf7693597cdf5cff6a9b0
4
+ data.tar.gz: bbbbbd5620af219e06075552ae34028fee5ee265
5
5
  SHA512:
6
- metadata.gz: 2448fd3775351ae4fdffa67c67475275d6a7dda1d1f86ff61ec6ba90135dac4ec00f44c2cf0372b5fd739817e1f97eb8ff4e1a3d837e7df0337e6c5e2437d476
7
- data.tar.gz: f4848113c76f9fd37195869b4b9e2682b15c2c51becf24b3ae04a115400e8d07828e7c6a36728c03c032df81919f0ddb5c613ebbafc9a13f85aa27d39edc04e7
6
+ metadata.gz: c1a8fd826c515648a02c8aaa53ff9f83b3af7eb47f6311c1cc4ec285e6998bcab83949bdd3c6cae2d2c0ebc55171a3e3b28e662829b7754f5d1aa9a830a34402
7
+ data.tar.gz: 3bb84421ca4ebffb78e8ea1953f306cd6e36f440b09403e3f4788eaf261b639bb78af0542336bfd651d6008b850a0caedd83ddaffc134cf384291a3c4c5739f7
@@ -1,6 +1,13 @@
1
+ # unreleased
2
+
3
+ # 0.1.2
4
+
5
+ Feature:
6
+ - Raise a `All3DP::API::BadGatewayError` on 502s
7
+
1
8
  # 0.1.1
2
9
 
3
- Patches:
10
+ Patch:
4
11
  - Add response code to API errors
5
12
 
6
13
  # 0.1.0
data/README.md CHANGED
@@ -36,10 +36,10 @@ interactive prompt that will allow you to experiment.
36
36
 
37
37
  ## Release
38
38
 
39
- To release a new version, update the version number in `version.rb`,
40
- and then run `bundle exec rake release`, which will create a git tag
41
- for the version, push git commits and tags, and push the `.gem` file
42
- to [rubygems.org](https://rubygems.org).
39
+ To release a new version, update the version number in `version.rb`, update
40
+ the CHANGELOG, commit, and then run `bundle exec rake release`, which will
41
+ create a git tag for the version, push git commits and tags, and push the
42
+ `.gem` file to [rubygems.org](https://rubygems.org).
43
43
 
44
44
  ## Contributing
45
45
 
@@ -4,6 +4,7 @@ module All3DP
4
4
  # Handle all calls to the API.
5
5
  class API
6
6
  class Error < StandardError; end
7
+ class BadGatewayError < Error; end
7
8
 
8
9
  def create_configuration(items:)
9
10
  url = "#{BASE_URL}/configuration"
@@ -13,16 +14,23 @@ module All3DP
13
14
  json: { items: items },
14
15
  )
15
16
 
16
- if response.code != 201
17
- raise Error, "Error #{response.code}: #{response.body.to_s.inspect}"
18
- end
19
-
20
- response.parse
17
+ parse_response(response)
21
18
  end
22
19
 
23
- # private
20
+ private
24
21
 
25
22
  BASE_URL = "https://printing-engine.all3dp.com"
26
23
  private_constant :BASE_URL
24
+
25
+ def parse_response(response)
26
+ case response.code
27
+ when 201
28
+ response.parse
29
+ when 502
30
+ raise BadGatewayError, response.body.to_s.strip
31
+ else
32
+ raise Error, "Error #{response.code}: #{response.body.to_s.inspect}"
33
+ end
34
+ end
27
35
  end
28
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module All3DP
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all3dp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http