Class: HockeyApp::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/hockeyapp/ws/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(ws) ⇒ Client

Returns a new instance of Client.



4
5
6
# File 'lib/hockeyapp/ws/client.rb', line 4

def initialize ws
  @ws = ws
end

Instance Method Details

#create_app(file_ipa) ⇒ Object



54
55
56
57
58
# File 'lib/hockeyapp/ws/client.rb', line 54

def create_app file_ipa
  resp = ws.post_new_app(file_ipa)
  raise resp['errors'].map{|e|e.to_s}.join("\n") unless resp['errors'].nil?
  App.from_hash(resp, self)
end

#get_appsObject



8
9
10
11
12
# File 'lib/hockeyapp/ws/client.rb', line 8

def get_apps
    apps_hash = ws.get_apps
    assert_success apps_hash
    apps_hash["apps"].map{|app_hash|App.from_hash(app_hash, self)}
end

#get_crash_description(crash) ⇒ Object



30
31
32
# File 'lib/hockeyapp/ws/client.rb', line 30

def get_crash_description crash
  ws.get_crash_description crash.app.public_identifier, crash.id
end

#get_crash_groups(app) ⇒ Object



20
21
22
23
24
# File 'lib/hockeyapp/ws/client.rb', line 20

def get_crash_groups app
  crash_groups_hash = ws.get_crash_groups app.public_identifier
  assert_success crash_groups_hash
  crash_groups_hash["crash_reasons"].map{|reason_hash|CrashGroup.from_hash(reason_hash, app, self)}
end

#get_crash_log(crash) ⇒ Object



26
27
28
# File 'lib/hockeyapp/ws/client.rb', line 26

def get_crash_log crash
  ws.get_crash_log crash.app.public_identifier, crash.id
end

#get_crashes(app) ⇒ Object



14
15
16
17
18
# File 'lib/hockeyapp/ws/client.rb', line 14

def get_crashes app
  crashes_hash = ws.get_crashes app.public_identifier
  assert_success crashes_hash
  crashes_hash["crashes"].map{|crash_hash|Crash.from_hash(crash_hash, app, self)}
end

#get_versions(app) ⇒ Object



34
35
36
37
# File 'lib/hockeyapp/ws/client.rb', line 34

def get_versions app
  versions_hash = ws.get_versions app.public_identifier
  versions_hash["app_versions"].map{|version_hash|Version.from_hash(version_hash, app, self)}
end

#post_new_version(version) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/hockeyapp/ws/client.rb', line 39

def post_new_version version
  app_id = version.app.public_identifier
  ipa = version.ipa
  raise "There must be an executable file" if ipa.nil?
  version_hash = ws.post_new_version(app_id, ipa, version.dsym, version.notes, version.notes_type, version.notify, version.status, version.tags)
  raise version_hash['errors'].map{|e|e.to_s}.join("\n") unless version_hash['errors'].nil?
  Version.from_hash(version_hash, version.app, self)
end

#remove_app(app) ⇒ Object



48
49
50
51
52
# File 'lib/hockeyapp/ws/client.rb', line 48

def remove_app app
  resp = ws.remove_app app.public_identifier
  raise "unexpected response" if resp.code != 200
  resp.code == 200
end