Class: HockeyApp::Version
- Inherits:
-
Object
- Object
- HockeyApp::Version
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations, ActiveModelCompliance
- Defined in:
- lib/hockeyapp/models/version.rb
Constant Summary collapse
- ATTRIBUTES =
[:id, :notes, :shortversion, :version, :mandatory, :timestamp, :appsize, :title, :download_url]
- POST_PAYLOAD =
[:status, :ipa, :dsym, :notes_type, :notify, :tags]
- NOTES_TYPES_TO_SYM =
{ 0 => :textile, 1 => :markdown }
- NOTIFY_TO_BOOL =
{ 0 => false, 1 => true }
- STATUS_TO_SYM =
{ 1 => :deny, 2 => :allow }
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Class Method Summary collapse
Instance Method Summary collapse
- #crash_reasons ⇒ Object
- #crashes ⇒ Object
- #direct_download_url ⇒ Object
-
#initialize(app, client) ⇒ Version
constructor
A new instance of Version.
- #install_url ⇒ Object
- #to_key ⇒ Object
Methods included from ActiveModelCompliance
Constructor Details
#initialize(app, client) ⇒ Version
Returns a new instance of Version.
45 46 47 48 49 |
# File 'lib/hockeyapp/models/version.rb', line 45 def initialize app, client @app = app @client = client default_values! end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
30 31 32 |
# File 'lib/hockeyapp/models/version.rb', line 30 def app @app end |
Class Method Details
.from_hash(h, app, client) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/hockeyapp/models/version.rb', line 37 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
#crash_reasons ⇒ Object
60 61 62 |
# File 'lib/hockeyapp/models/version.rb', line 60 def crash_reasons @crash_groups ||= @app.crash_reasons.select{|crash_reason| "#{crash_reason.app_version_id}" == @id.to_s} end |
#crashes ⇒ Object
56 57 58 |
# File 'lib/hockeyapp/models/version.rb', line 56 def crashes @crashes ||= @app.crashes.select{|crash| "#{crash.app_version_id}" == @id.to_s} end |
#direct_download_url ⇒ Object
65 66 67 |
# File 'lib/hockeyapp/models/version.rb', line 65 def direct_download_url url_strategy.direct_download_url end |
#install_url ⇒ Object
69 70 71 |
# File 'lib/hockeyapp/models/version.rb', line 69 def install_url url_strategy.install_url end |
#to_key ⇒ Object
52 53 54 |
# File 'lib/hockeyapp/models/version.rb', line 52 def to_key [@id] if persisted? end |