Class: JustGiving::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/just_giving/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ Response

Returns a new instance of Response.



4
5
6
7
# File 'lib/just_giving/response.rb', line 4

def initialize(errors)
  @errors = []
  errors.each{|e| @errors << Hashie::Mash.new(e)}
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/just_giving/response.rb', line 3

def errors
  @errors
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/just_giving/response.rb', line 13

def [](key)
  if respond_to?(key.to_sym)
    send(key.to_sym)
  else
    nil
  end
end

#any?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/just_giving/response.rb', line 9

def any?
  errors.any?
end