Class: Crep::HockeyAppAppSource

Inherits:
AppSource show all
Defined in:
lib/crep/model/app_source/hockeyapp_app_source.rb

Instance Attribute Summary

Attributes inherited from AppSource

#version

Instance Method Summary collapse

Instance Method Details

#appsObject


18
19
20
# File 'lib/crep/model/app_source/hockeyapp_app_source.rb', line 18

def apps
  @client.get_apps
end

#configureObject


9
10
11
12
13
14
15
16
# File 'lib/crep/model/app_source/hockeyapp_app_source.rb', line 9

def configure
  HockeyApp::Config.configure do |config|
    raise 'Missing API token (CREP_HOCKEY_API_TOKEN)' unless ENV['CREP_HOCKEY_API_TOKEN']
    config.token = ENV['CREP_HOCKEY_API_TOKEN']
  end

  @client = HockeyApp.build_client
end

#versions(app_identifier) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/crep/model/app_source/hockeyapp_app_source.rb', line 22

def versions(app_identifier)
  apps = @client.get_apps.select do |a|
    a.public_identifier == app_identifier
  end

  raise("Unable to find app with identifier: #{app_identifier}") unless apps.count.positive?

  app = apps.first
  app.versions.map do |version|
    Crep::Version.new(version.shortversion, version.version, app.public_identifier.downcase)
  end
end