Class: GeoCerts::ApiObject

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_certs/api_object.rb

Overview

:nodoc:

Direct Known Subclasses

Agreement, Certificate, Event, FraudScore, Hello, Order, Product, Reseller

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ApiObject) initialize(attributes = {}) {|_self| ... }

A new instance of ApiObject

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
# File 'lib/geo_certs/api_object.rb', line 7

def initialize(attributes = {}, &block)
  update_attributes(attributes)
  yield(self) if block_given?
end

Instance Attribute Details

- (Object) response_parameters

Returns the value of attribute response_parameters



5
6
7
# File 'lib/geo_certs/api_object.rb', line 5

def response_parameters
  @response_parameters
end

Instance Method Details

- (Object) errors



12
13
14
# File 'lib/geo_certs/api_object.rb', line 12

def errors
  @errors ||= []
end

- (Object) errors=(input)

:nodoc:



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/geo_certs/api_object.rb', line 32

def errors=(input) # :nodoc:
  @errors = case input
    when Hash
      case input[:error]
      when Array
        input[:error].collect { |error| GeoCerts::Error.new(error) }
      end
    when Array
      input if input.all? { |item| item.kind_of?(GeoCerts::Error) }
    end
end

- (Object) warnings



16
17
18
# File 'lib/geo_certs/api_object.rb', line 16

def warnings
  @warnings ||= []
end

- (Object) warnings=(input)

:nodoc:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/geo_certs/api_object.rb', line 20

def warnings=(input) # :nodoc:
  @warnings = case input
    when Hash
      case input[:warning]
      when Array
        input[:warning].collect { |warning| GeoCerts::Warning.new(warning) }
      end
    when Array
      input if input.all? { |item| item.kind_of?(GeoCerts::Warning) }
    end
end