shutl_resource 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,14 +1,17 @@
1
1
  language: ruby
2
- matrix:
3
- allow_failures:
4
- - jruby-19mode
5
2
 
6
3
  rvm:
7
4
  - 1.9.2
8
- - "1.9.3"
9
- - jruby-19mode # JRuby in 1.9 mode
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+
10
9
  jdk:
11
10
  - openjdk7
12
11
  - oraclejdk7
13
12
 
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: jruby-18mode
16
+ - rvm: jruby-19mode
14
17
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Shutl::Resource
2
2
 
3
+ [![Build Status](https://travis-ci.org/shutl/shutl_resource.png?branch=master)](https://travis-ci.org/shutl/shutl_resource)
4
+
3
5
  Yep this is ActiveResource-esque.
4
6
 
5
7
  Abstracted from our backend, but no reason to not make this public. Possibly
@@ -51,7 +53,7 @@ It uses OAuth2 Bearer tokens for API calls using the shutl_auth gem
51
53
  e.g. the following header is attached to requests
52
54
 
53
55
  `
54
- Authorization: Bearer some/big/long/base64/thing/goes/here==
56
+ Authorization: Bearer some-big-long-urlsafe-base64-thing-goes-here
55
57
  `
56
58
 
57
59
 
@@ -7,7 +7,7 @@ module Shutl::Resource
7
7
 
8
8
  def raise_exceptions_on_validation
9
9
  if @raise_exceptions_on_validation.nil?
10
- @raise_exceptions_on_validation = true
10
+ @raise_exceptions_on_validation = false
11
11
  end
12
12
 
13
13
  @raise_exceptions_on_validation
@@ -9,6 +9,7 @@ module Shutl::Resource
9
9
  url = member_url args.dup, params
10
10
  response = get url, headers_with_auth(token)
11
11
 
12
+
12
13
  check_fail response, "Failed to find #{name} with the id #{id}"
13
14
 
14
15
  parsed = response.parsed_response
@@ -193,7 +194,14 @@ module Shutl::Resource
193
194
  Shutl::ServerError
194
195
  end
195
196
 
196
- raise failure_klass.new message, response if failure_klass
197
+
198
+ output = begin
199
+ response.parsed_response["errors"]["base"]
200
+ rescue
201
+ message
202
+ end
203
+
204
+ raise failure_klass.new output, response if failure_klass
197
205
  end
198
206
 
199
207
  protected
@@ -1,5 +1,5 @@
1
1
  module Shutl
2
2
  module Resource
3
- VERSION = '0.8.0'
3
+ VERSION = '0.8.1'
4
4
  end
5
5
  end
@@ -43,6 +43,7 @@ describe Shutl::Resource::Rest do
43
43
  resource.instance_variable_get('@b').should == 2
44
44
  end
45
45
 
46
+ Shutl::Resource.raise_exceptions_on_validation = true
46
47
  {
47
48
  400 => Shutl::BadRequest,
48
49
  401 => Shutl::UnauthorizedAccess,
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: shutl_resource
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Rouchy
@@ -11,136 +11,136 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-19 00:00:00.000000000 Z
14
+ date: 2013-02-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- type: :runtime
18
17
  version_requirements: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
19
  - - ~>
22
20
  - !ruby/object:Gem::Version
23
21
  version: 0.10.0
22
+ none: false
24
23
  name: httparty
24
+ type: :runtime
25
25
  prerelease: false
26
26
  requirement: !ruby/object:Gem::Requirement
27
- none: false
28
27
  requirements:
29
28
  - - ~>
30
29
  - !ruby/object:Gem::Version
31
30
  version: 0.10.0
31
+ none: false
32
32
  - !ruby/object:Gem::Dependency
33
- type: :runtime
34
33
  version_requirements: !ruby/object:Gem::Requirement
35
- none: false
36
34
  requirements:
37
35
  - - '='
38
36
  - !ruby/object:Gem::Version
39
37
  version: 0.8.0
38
+ none: false
40
39
  name: shutl_auth
40
+ type: :runtime
41
41
  prerelease: false
42
42
  requirement: !ruby/object:Gem::Requirement
43
- none: false
44
43
  requirements:
45
44
  - - '='
46
45
  - !ruby/object:Gem::Version
47
46
  version: 0.8.0
47
+ none: false
48
48
  - !ruby/object:Gem::Dependency
49
- type: :runtime
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
- none: false
52
50
  requirements:
53
51
  - - ! '>='
54
52
  - !ruby/object:Gem::Version
55
53
  version: '0'
54
+ none: false
56
55
  name: activemodel
56
+ type: :runtime
57
57
  prerelease: false
58
58
  requirement: !ruby/object:Gem::Requirement
59
- none: false
60
59
  requirements:
61
60
  - - ! '>='
62
61
  - !ruby/object:Gem::Version
63
62
  version: '0'
63
+ none: false
64
64
  - !ruby/object:Gem::Dependency
65
- type: :development
66
65
  version_requirements: !ruby/object:Gem::Requirement
67
- none: false
68
66
  requirements:
69
67
  - - ! '>='
70
68
  - !ruby/object:Gem::Version
71
69
  version: '0'
70
+ none: false
72
71
  name: rake
72
+ type: :development
73
73
  prerelease: false
74
74
  requirement: !ruby/object:Gem::Requirement
75
- none: false
76
75
  requirements:
77
76
  - - ! '>='
78
77
  - !ruby/object:Gem::Version
79
78
  version: '0'
79
+ none: false
80
80
  - !ruby/object:Gem::Dependency
81
- type: :development
82
81
  version_requirements: !ruby/object:Gem::Requirement
83
- none: false
84
82
  requirements:
85
83
  - - ~>
86
84
  - !ruby/object:Gem::Version
87
85
  version: 2.11.0
86
+ none: false
88
87
  name: rspec
88
+ type: :development
89
89
  prerelease: false
90
90
  requirement: !ruby/object:Gem::Requirement
91
- none: false
92
91
  requirements:
93
92
  - - ~>
94
93
  - !ruby/object:Gem::Version
95
94
  version: 2.11.0
95
+ none: false
96
96
  - !ruby/object:Gem::Dependency
97
- type: :development
98
97
  version_requirements: !ruby/object:Gem::Requirement
99
- none: false
100
98
  requirements:
101
99
  - - ! '>='
102
100
  - !ruby/object:Gem::Version
103
101
  version: '0'
102
+ none: false
104
103
  name: debugger
104
+ type: :development
105
105
  prerelease: false
106
106
  requirement: !ruby/object:Gem::Requirement
107
- none: false
108
107
  requirements:
109
108
  - - ! '>='
110
109
  - !ruby/object:Gem::Version
111
110
  version: '0'
111
+ none: false
112
112
  - !ruby/object:Gem::Dependency
113
- type: :development
114
113
  version_requirements: !ruby/object:Gem::Requirement
115
- none: false
116
114
  requirements:
117
115
  - - ! '>='
118
116
  - !ruby/object:Gem::Version
119
117
  version: '0'
118
+ none: false
120
119
  name: vcr
120
+ type: :development
121
121
  prerelease: false
122
122
  requirement: !ruby/object:Gem::Requirement
123
- none: false
124
123
  requirements:
125
124
  - - ! '>='
126
125
  - !ruby/object:Gem::Version
127
126
  version: '0'
127
+ none: false
128
128
  - !ruby/object:Gem::Dependency
129
- type: :development
130
129
  version_requirements: !ruby/object:Gem::Requirement
131
- none: false
132
130
  requirements:
133
131
  - - ~>
134
132
  - !ruby/object:Gem::Version
135
133
  version: 1.8.7
134
+ none: false
136
135
  name: webmock
136
+ type: :development
137
137
  prerelease: false
138
138
  requirement: !ruby/object:Gem::Requirement
139
- none: false
140
139
  requirements:
141
140
  - - ~>
142
141
  - !ruby/object:Gem::Version
143
142
  version: 1.8.7
143
+ none: false
144
144
  description: Shutl Rest resource
145
145
  email:
146
146
  - davidr@shutl.co.uk
@@ -215,23 +215,17 @@ rdoc_options: []
215
215
  require_paths:
216
216
  - lib
217
217
  required_ruby_version: !ruby/object:Gem::Requirement
218
- none: false
219
218
  requirements:
220
219
  - - ! '>='
221
220
  - !ruby/object:Gem::Version
222
- segments:
223
- - 0
224
- hash: -2260222592976093947
225
221
  version: '0'
226
- required_rubygems_version: !ruby/object:Gem::Requirement
227
222
  none: false
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
228
224
  requirements:
229
225
  - - ! '>='
230
226
  - !ruby/object:Gem::Version
231
- segments:
232
- - 0
233
- hash: -2260222592976093947
234
227
  version: '0'
228
+ none: false
235
229
  requirements: []
236
230
  rubyforge_project:
237
231
  rubygems_version: 1.8.23