amiando 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -10,7 +10,8 @@ module Amiando
10
10
  class Result
11
11
  include Amiando::Autorun
12
12
 
13
- attr_accessor :request, :response, :errors, :success
13
+ attr_accessor :request, :response, :errors
14
+ attr_reader :result, :success
14
15
 
15
16
  autorun :request, :response, :result, :errors, :success
16
17
 
@@ -32,7 +32,7 @@ module Amiando
32
32
  #
33
33
  # @param event id
34
34
  #
35
- # @return [TicektShop] the event's ticketshop
35
+ # @return [TicketShop] the event's ticketshop
36
36
  def self.find(event_id)
37
37
  object = new
38
38
  get object, "api/event/#{event_id}/ticketShop"
@@ -1,3 +1,3 @@
1
1
  module Amiando
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -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: 17
5
- prerelease:
4
+ hash: 23
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
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.6.2
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