Class: XporterOnDemand::Result::Base

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/xporter_on_demand/result/base.rb

Instance Method Summary collapse

Methods included from Utils

#assign_attributes, #configure_request, #create_result, #dont_raise_exception, #handle_exceptions, #parameterize, #unwrap

Constructor Details

#initialize(args = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/xporter_on_demand/result/base.rb', line 6

def initialize(args = {})
  result = args.delete(:result)
  assign_attributes(result)
end

Instance Method Details

#typeObject



11
12
13
# File 'lib/xporter_on_demand/result/base.rb', line 11

def type
  self.class.name.demodulize
end

#update(other_result) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/xporter_on_demand/result/base.rb', line 15

def update(other_result)
  return if other_result.type != type ||\
            other_result.id != id ||\
            other_result.last_updated <= last_updated

  attributes.each do |attribute|
    send("#{attribute}=", other_result.send(attribute))
  end
end