api-client 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/api-client/base.rb +4 -3
- data/lib/api-client/version.rb +1 -1
- data/spec/api-client/base_spec.rb +10 -0
- metadata +2 -2
data/lib/api-client/base.rb
CHANGED
@@ -14,9 +14,6 @@ class ApiClient::Base
|
|
14
14
|
extend ApiClient::Parser
|
15
15
|
extend ApiClient::Dispatcher
|
16
16
|
|
17
|
-
# @params [Hash] Hash of errors.
|
18
|
-
attr_writer :errors
|
19
|
-
|
20
17
|
# Initialize an object based on a hash of attributes.
|
21
18
|
#
|
22
19
|
# @param [Hash] attributes object attributes.
|
@@ -41,6 +38,10 @@ class ApiClient::Base
|
|
41
38
|
@errors ||= ApiClient::Errors.new(self)
|
42
39
|
end
|
43
40
|
|
41
|
+
def errors=(errors = {})
|
42
|
+
@errors = Hash[errors.map{|(key,value)| [key.to_sym,value]}]
|
43
|
+
end
|
44
|
+
|
44
45
|
# Make a get request and returns a new instance with te response attributes.
|
45
46
|
#
|
46
47
|
# @param [String] url of the api request.
|
data/lib/api-client/version.rb
CHANGED
@@ -44,4 +44,14 @@ describe ApiClient::Base do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
describe "#errors=" do
|
49
|
+
before :each do
|
50
|
+
@user = User.new(:errors => { "a" => "message", "b" => "message" })
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should set @errors with symbolic keys" do
|
54
|
+
@user.errors.should == { :a => "message", :b => "message" }
|
55
|
+
end
|
56
|
+
end
|
47
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|