Class: HockeyApp::Crash

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations, ActiveModelCompliance
Defined in:
lib/hockeyapp/models/crash.rb

Constant Summary collapse

ATTRIBUTES =
[:crash_reason_id, :id, :jail_break, :created_at, :updated_at, :contact_string, :app_id, :bundle_version,
:app_version_id, :user_string, :has_description, :bundle_short_version, :has_log, :model, :oem, :os_version]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveModelCompliance

#persisted?, #to_model

Constructor Details

#initialize(app, client) ⇒ Crash

Returns a new instance of Crash.



23
24
25
26
# File 'lib/hockeyapp/models/crash.rb', line 23

def initialize app, client
  @app = app
  @client = client
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



12
13
14
# File 'lib/hockeyapp/models/crash.rb', line 12

def app
  @app
end

Class Method Details

.from_hash(h, app, client) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/hockeyapp/models/crash.rb', line 15

def self.from_hash(h, app, client)
  res = self.new app, client
  ATTRIBUTES.each do |attribute|
    res.send("#{attribute.to_s}=", h[attribute.to_s]) unless (h[attribute.to_s].nil?)
  end
  res
end

Instance Method Details

#descriptionObject



33
34
35
# File 'lib/hockeyapp/models/crash.rb', line 33

def description
  @description ||= client.get_crash_description(self) if has_description
end

#logObject



29
30
31
# File 'lib/hockeyapp/models/crash.rb', line 29

def log
  @log ||= client.get_crash_log(self) if has_log
end