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 => :none, 1 => :all_allowed, 2 => :all }
- 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.
46 47 48 49 50 |
# File 'lib/hockeyapp/models/version.rb', line 46 def initialize app, client @app = app @client = client default_values! end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
31 32 33 |
# File 'lib/hockeyapp/models/version.rb', line 31 def app @app end |
Class Method Details
.from_hash(h, app, client) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/hockeyapp/models/version.rb', line 38 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
61 62 63 |
# File 'lib/hockeyapp/models/version.rb', line 61 def crash_reasons @crash_groups ||= @app.crash_reasons.select{|crash_reason| "#{crash_reason.app_version_id}" == @id.to_s} end |
#crashes ⇒ Object
57 58 59 |
# File 'lib/hockeyapp/models/version.rb', line 57 def crashes @crashes ||= @app.crashes.select{|crash| "#{crash.app_version_id}" == @id.to_s} end |
#direct_download_url ⇒ Object
66 67 68 |
# File 'lib/hockeyapp/models/version.rb', line 66 def direct_download_url url_strategy.direct_download_url end |
#install_url ⇒ Object
70 71 72 |
# File 'lib/hockeyapp/models/version.rb', line 70 def install_url url_strategy.install_url end |
#to_key ⇒ Object
53 54 55 |
# File 'lib/hockeyapp/models/version.rb', line 53 def to_key [@id] if persisted? end |