moonrope-client 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3feea27b7e635c85fad5d5ddccb2247b03da1cbb
4
- data.tar.gz: fa326202f65dabc5de9379d6d0def3107bc3e496
2
+ SHA256:
3
+ metadata.gz: 715eb9deabcf5fa5b513b07b25bd56622ee65f875e91c90e0213c5c3367af6c3
4
+ data.tar.gz: 2ffd7298b3c239781aab0466be505aee305e6606b393f989d6a7b2764e5653fd
5
5
  SHA512:
6
- metadata.gz: 404232dd138bd72fdb9735ccb9f389a026de437d85bbd9e5f332eeecf8cd81641bb5070dc537651c8425725be3ea7696f7e9886835998ea5188ebf3bdfae797d
7
- data.tar.gz: 69c998c287e4a2474ed05468c902e4b032073de02b5f586b969bfd7a46d3962af4f240f63c8ae16fd97e87a34d782fa19ce068a621f4b1ea37b293dadc536b01
6
+ metadata.gz: ffbaa74e05ae1d9089c95d1abc9bd764b07df63989628d8c65c9de517860f6305216be46be8cd1798aa176827793287173c09c734f85080eda98af51e431b6c5
7
+ data.tar.gz: cfd048af82d5e94625b7011d9cb2e2f1e0017974110bf1aaa7c6a0be2f79d5b779878defc2a649fe0f37a7b5c6850d9f1dc825078790bb5c73c75916994720a4
@@ -103,8 +103,11 @@ module MoonropeClient
103
103
  result = connection.request(request)
104
104
  case result.code.to_i
105
105
  when 200 then result.body
106
- when 400 then raise Error, "Bad request"
107
- else raise Error, "Internal server error occurred"
106
+ when 400 then raise Error, "Bad request (400)"
107
+ when 403 then raise Error, "Access denied (403)"
108
+ when 404 then raise Error, "Page not found (404)"
109
+ when 500 then raise Error, "Internal server error (500)"
110
+ else raise Error, "Unexpected status code #{result.code.to_i}"
108
111
  end
109
112
  end
110
113
 
@@ -29,7 +29,7 @@ module MoonropeClient
29
29
  if result.success?
30
30
  result
31
31
  else
32
- raise MoonropeClient::RequestError.new(result), "Request was not successful. Got #{result.class}"
32
+ raise MoonropeClient::RequestError.new(result), "Request was not successful. Got #{result.class} (#{result.exception_message})."
33
33
  end
34
34
  end
35
35
 
@@ -48,5 +48,12 @@ module MoonropeClient
48
48
  @data['time']
49
49
  end
50
50
 
51
+ #
52
+ # @return [Strig] the string for representing this response in an exception
53
+ #
54
+ def exception_message
55
+ self.data
56
+ end
57
+
51
58
  end
52
59
  end
@@ -1,11 +1,15 @@
1
1
  module MoonropeClient
2
2
  module Responses
3
3
  class AccessDenied < Response
4
-
4
+
5
5
  def message
6
6
  data['message']
7
7
  end
8
-
8
+
9
+ def exception_message
10
+ self.message
11
+ end
12
+
9
13
  end
10
14
  end
11
15
  end
@@ -1,11 +1,15 @@
1
1
  module MoonropeClient
2
2
  module Responses
3
3
  class ParameterError < Response
4
-
4
+
5
5
  def message
6
6
  data['message']
7
7
  end
8
-
8
+
9
+ def exception_message
10
+ self.message
11
+ end
12
+
9
13
  end
10
14
  end
11
15
  end
@@ -1,11 +1,15 @@
1
1
  module MoonropeClient
2
2
  module Responses
3
3
  class ValidationError < Response
4
-
4
+
5
5
  def errors
6
6
  data['errors']
7
7
  end
8
-
8
+
9
+ def exception_message
10
+ self.errors.join(', ')
11
+ end
12
+
9
13
  end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module MoonropeClient
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,55 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moonrope-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-04 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 1.8.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.8'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 1.8.0
33
- - !ruby/object:Gem::Dependency
34
- name: yard
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
30
  - - "~>"
38
31
  - !ruby/object:Gem::Version
39
- version: '0.8'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.8.0
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.8'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.8.0
32
+ version: '1.8'
53
33
  description: A full client library allows requests to made to Moonrope-enabled API
54
34
  endpoints.
55
35
  email:
@@ -90,10 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
70
  - !ruby/object:Gem::Version
91
71
  version: '0'
92
72
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.5.1
73
+ rubygems_version: 3.0.6
95
74
  signing_key:
96
75
  specification_version: 4
97
76
  summary: A client library for the the Moonrope API server.
98
77
  test_files: []
99
- has_rdoc: