Module: NeverBounce::API::Feature::Oattrs::InstanceMethods

Defined in:
lib/never_bounce/api/feature/oattrs.rb

Instance Method Summary collapse

Instance Method Details

#touchself

Load all oattrs by “touching” them.

irb> resp = client.jobs_delete(job_id: 353701)
=> #<NeverBounce::API::Response::ErrorMessage:0x0056245978aec8>
irb> resp.touch
=> #<NeverBounce::API::Response::ErrorMessage:0x0056245978aec8 @message="Invalid job ID 353701", @execution_time=15, @status="general_failure">

Returns:

  • (self)


77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/never_bounce/api/feature/oattrs.rb', line 77

def touch
  self.class.oattrs.each do |name|
    v = public_send(name)

    # Touch recursively. Support simple collections.
    if v.respond_to? :touch
      v.touch
    elsif v.is_a? Array
      v.each { |r| r.touch if r.respond_to? :touch }
    end
  end

  self
end