Class: HockeyApp::App
- Inherits:
-
Object
- Object
- HockeyApp::App
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations, ActiveModelCompliance
- Defined in:
- lib/hockeyapp/models/app.rb
Constant Summary collapse
- ANDROID =
'Android'
- IOS =
'iOS'
- ATTRIBUTES =
[:title, :minimum_os_version, :status, :company, :owner, :bundle_identifier, :device_family, :platform, :public_identifier, :role, :release_type]
- POST_PAYLOAD =
[:status,:notes_type, :notify]
- NOTES_TYPES_TO_SYM =
{ 0 => :textile, 1 => :markdown }
- NOTIFY_TO_BOOL =
{ 0 => false, 1 => true }
- STATUS_TO_SYM =
{ 1 => :deny, 2 => :allow }
Class Method Summary collapse
Instance Method Summary collapse
- #crash_reasons ⇒ Object
- #crashes ⇒ Object
- #create_version(file, release_notes = "") ⇒ Object
- #direct_download_url ⇒ Object
- #download_url ⇒ Object
- #icon ⇒ Object
-
#initialize(client) ⇒ App
constructor
A new instance of App.
- #install_url ⇒ Object
- #last_version ⇒ Object
- #platform=(platform) ⇒ Object
- #remove ⇒ Object
- #to_key ⇒ Object
- #versions ⇒ Object
Methods included from ActiveModelCompliance
Constructor Details
#initialize(client) ⇒ App
Returns a new instance of App.
49 50 51 |
# File 'lib/hockeyapp/models/app.rb', line 49 def initialize client @client = client end |
Class Method Details
.from_hash(h, client) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/hockeyapp/models/app.rb', line 41 def self.from_hash(h, client) res = self.new 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
65 66 67 |
# File 'lib/hockeyapp/models/app.rb', line 65 def crash_reasons @crash_reasons ||= client.get_crash_groups(self) end |
#crashes ⇒ Object
61 62 63 |
# File 'lib/hockeyapp/models/app.rb', line 61 def crashes @crashes ||= client.get_crashes(self) end |
#create_version(file, release_notes = "") ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/hockeyapp/models/app.rb', line 94 def create_version file, release_notes = "" version = Version.new(self, @client) version.ipa = file version.notes = release_notes client.post_new_version version @versions = nil end |
#direct_download_url ⇒ Object
86 87 88 |
# File 'lib/hockeyapp/models/app.rb', line 86 def direct_download_url url_strategy.direct_download_url end |
#download_url ⇒ Object
82 83 84 |
# File 'lib/hockeyapp/models/app.rb', line 82 def download_url last_version.download_url end |
#icon ⇒ Object
78 79 80 |
# File 'lib/hockeyapp/models/app.rb', line 78 def icon "https://rink.hockeyapp.net/api/2/apps/#{public_identifier}?format=png" end |
#install_url ⇒ Object
90 91 92 |
# File 'lib/hockeyapp/models/app.rb', line 90 def install_url url_strategy.install_url end |
#last_version ⇒ Object
73 74 75 76 |
# File 'lib/hockeyapp/models/app.rb', line 73 def last_version sorted_version = versions.sort_by { |v| v.version.to_i} sorted_version.last end |
#platform=(platform) ⇒ Object
57 58 59 |
# File 'lib/hockeyapp/models/app.rb', line 57 def platform= platform @platform = platform end |
#remove ⇒ Object
102 103 104 |
# File 'lib/hockeyapp/models/app.rb', line 102 def remove client.remove_app self end |
#to_key ⇒ Object
53 54 55 |
# File 'lib/hockeyapp/models/app.rb', line 53 def to_key [public_identifier] if persisted? end |
#versions ⇒ Object
69 70 71 |
# File 'lib/hockeyapp/models/app.rb', line 69 def versions @versions ||= client.get_versions(self) end |