class Hockey::App

App on HockeyApp

@see support.hockeyapp.net/kb/api/api-apps HokceyApp Apps API Reference

Attributes

bundle_identifier[R]
device_family[R]
minimum_os_version[R]
net[R]
original_hash[R]
platform[R]
public_identifier[R]
release_type[R]
status[R]
title[R]

Public Class Methods

create_from(hashobj, networking) click to toggle source

Construct a new instance of {App}

@param hashobj [Hash] an instance of app receiving from HockeyApp @param networking [Hockey::Networking] an instance of Hockey::Networking object

# File lib/hockeyhelper/app.rb, line 26
def self.create_from(hashobj, networking)
  self.new hashobj, networking
end
new(hashobj, networking) click to toggle source

Construct a new instance of {App}

# File lib/hockeyhelper/app.rb, line 31
def initialize(hashobj, networking)
  @title = hashobj['title']
  @bundle_identifier = hashobj['bundle_identifier']
  @public_identifier = hashobj['public_identifier']
  @device_family = hashobj['device_family']
  @minimum_os_version = hashobj['minimum_os_version']
  @release_type = hashobj['release_type']
  @status = hashobj['status']
  @platform = hashobj['platform']
  @original_hash = hashobj
  @net = networking
  @cached_users = nil
  @cached_versions = nil
end

Public Instance Methods

crash_reasons(page: 1, symbolicated: true, sort: :date, order: :asc) click to toggle source

List all crash groups for an app. return an Array of CrashReason objects.

sort parameter:

:date, :class, :number_of_crashes, :last_crash_at

order parameter:

:asc, :desc
# File lib/hockeyhelper/app.rb, line 115
def crash_reasons(page: 1, symbolicated: true, sort: :date, order: :asc)
  obj = @net.get_object "/api/2/apps/#{@public_identifier}/crash_reasons"

  cr = []
  obj['crash_reasons'].each do |hashobj|
    cr << CrashReason.create_from(hashobj, @net)
  end

  cr
end
crashes_histogram(date: Date.today, version: nil) click to toggle source
# File lib/hockeyhelper/app.rb, line 126
def crashes_histogram(date: Date.today, version: nil)
  start = date.strftime
  url = "/api/2/apps/#{@public_identifier}"
  if version
    url += "/app_versions/#{version.id}/crashes/histogram?start_date=#{start}&end_date=#{start}"
  else
    url += "/crashes/histogram?start_date=#{start}&end_date=#{start}"
  end
  obj = @net.get_object url
  histogram ||= {}
  obj['histogram'].each do |arr|
    histogram = {:date=>arr[0], :count=>arr[1]}
  end

  histogram
end
inspect() click to toggle source
# File lib/hockeyhelper/app.rb, line 46
def inspect
  "#{@title}, #{@bundle_identifier}, #{@platform}, #{@public_identifier}"
end
Also aliased as: to_s
invite_user(email: '') click to toggle source

Invite a user to an app. return a User object.

# File lib/hockeyhelper/app.rb, line 69
def invite_user(email: '')
  obj = @net.post_object "/api/2/apps/#{@public_identifier}/app_users", {:email=>email, :role=>1}

  user = User.create_from(obj, @net)

  user
end
remove_user(email: nil) click to toggle source

Remove a user from an app on HockeyApp.

# File lib/hockeyhelper/app.rb, line 78
def remove_user(email: nil)
  begin
    total_pages = users().total_pages
  rescue => e
    return
  end

  1.upto(total_pages) do |page|
    user = users(page: page).find {|u| u.email == email }
    if user
      @net.delete "/api/2/apps/#{@public_identifier}/app_users/#{user.id}"
    end
  end
end
to_s()
Alias for: inspect
users(page: 1) click to toggle source

List all users of an app on HockeyApp.

@return [Array<User>] fetched {User} objects from HockeyApp.

# File lib/hockeyhelper/app.rb, line 54
def users(page: 1)
  @cached_users ||= []

  if @cached_users.empty?
    obj = @net.get_object "/api/2/apps/#{@public_identifier}/app_users"
    obj['app_users'].each do |hashobj|
      @cached_users << User.create_from(hashobj, @net)
    end
  end

  PagingArray.paginate with: @cached_users, page: page
end
versions(page: 1) click to toggle source

List all versions of an app. The endpoint returns all versions for developer and members, but only released versions for testers. return an Array of Version objects.

# File lib/hockeyhelper/app.rb, line 95
def versions(page: 1)
  @cached_versions ||= []

  if @cached_versions.empty?
    obj = @net.get_object "/api/2/apps/#{@public_identifier}/app_versions"
    obj['app_versions'].each do |hashobj|
      @cached_versions << Version.create_from(hashobj, @net)
    end
  end

  PagingArray.paginate with: @cached_versions, page: page
end