amiando 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amiando/boolean.rb +3 -9
- data/lib/amiando/result.rb +2 -1
- data/lib/amiando/ticket_shop.rb +1 -1
- data/lib/amiando/version.rb +1 -1
- data/test/amiando/boolean_test.rb +7 -0
- metadata +5 -5
data/lib/amiando/boolean.rb
CHANGED
@@ -11,8 +11,9 @@ module Amiando
|
|
11
11
|
include Amiando::Autorun
|
12
12
|
|
13
13
|
attr_accessor :request, :response
|
14
|
+
attr_reader :result, :success
|
14
15
|
|
15
|
-
autorun :request, :response, :result
|
16
|
+
autorun :request, :response, :result, :success
|
16
17
|
|
17
18
|
def initialize(response_attribute)
|
18
19
|
@response_attribute = response_attribute.to_s
|
@@ -21,17 +22,10 @@ module Amiando
|
|
21
22
|
def populate(response_body)
|
22
23
|
if response_body.key?(@response_attribute)
|
23
24
|
@result = response_body[@response_attribute]
|
25
|
+
@success = response_body['success']
|
24
26
|
else
|
25
27
|
raise Error::NotInitialized.new("The response doesn't have the expected attribute")
|
26
28
|
end
|
27
29
|
end
|
28
|
-
|
29
|
-
def result
|
30
|
-
if defined?(@result)
|
31
|
-
@result
|
32
|
-
else
|
33
|
-
raise Error::NotInitialized.new('Called result before the query was run')
|
34
|
-
end
|
35
|
-
end
|
36
30
|
end
|
37
31
|
end
|
data/lib/amiando/result.rb
CHANGED
@@ -10,7 +10,8 @@ module Amiando
|
|
10
10
|
class Result
|
11
11
|
include Amiando::Autorun
|
12
12
|
|
13
|
-
attr_accessor :request, :response, :errors
|
13
|
+
attr_accessor :request, :response, :errors
|
14
|
+
attr_reader :result, :success
|
14
15
|
|
15
16
|
autorun :request, :response, :result, :errors, :success
|
16
17
|
|
data/lib/amiando/ticket_shop.rb
CHANGED
data/lib/amiando/version.rb
CHANGED
@@ -18,4 +18,11 @@ describe Amiando::Boolean do
|
|
18
18
|
|
19
19
|
boolean.result.must_equal false
|
20
20
|
end
|
21
|
+
|
22
|
+
it "sets the success value from the request" do
|
23
|
+
boolean = Amiando::Boolean.new(:wadus)
|
24
|
+
boolean.populate('wadus' => true, 'success' => false)
|
25
|
+
|
26
|
+
boolean.success.must_equal false
|
27
|
+
end
|
21
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amiando
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jorge Dias
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
requirements: []
|
247
247
|
|
248
248
|
rubyforge_project: amiando
|
249
|
-
rubygems_version: 1.
|
249
|
+
rubygems_version: 1.3.7
|
250
250
|
signing_key:
|
251
251
|
specification_version: 3
|
252
252
|
summary: A ruby client for the amiando REST API
|