hockeyhelper 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/hockey.gemspec +1 -0
- data/lib/hockeyhelper/app.rb +34 -24
- data/lib/hockeyhelper/client.rb +1 -5
- data/lib/hockeyhelper/paging_array.rb +11 -0
- data/lib/hockeyhelper/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 212599997dfc02a934cd61af78a1a0281870879a
|
4
|
+
data.tar.gz: fb1888ebfb274ceb17ec9f1640bc7c15ff746a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 741a038849604a3f5880625086cbdb92e29ba859cbdd6e15071892cbb05ebb87f6714cd1432d00749a66060e7cb6ad79775f343e4a31a792942145e018630629
|
7
|
+
data.tar.gz: dc029688584ed5047d4d8e7a933200d4f4f08e70affcd28b7cd9341456033c757bf69eafd4eeae9a689edb111aa04d1e3e84f67f22ec5c19389cee074ee5051f
|
data/hockey.gemspec
CHANGED
data/lib/hockeyhelper/app.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
require_relative 'paging_array'
|
2
|
+
|
1
3
|
module Hockey
|
2
4
|
|
3
5
|
# App on HockeyApp
|
6
|
+
#
|
7
|
+
# @see http://support.hockeyapp.net/kb/api/api-apps HokceyApp Apps API Reference
|
4
8
|
class App
|
5
9
|
|
6
10
|
attr_reader :title
|
@@ -15,10 +19,15 @@ module Hockey
|
|
15
19
|
|
16
20
|
attr :net
|
17
21
|
|
22
|
+
# Construct a new instance of {App}
|
23
|
+
#
|
24
|
+
# @param hashobj [Hash] an instance of app receiving from HockeyApp
|
25
|
+
# @param networking [Hockey::Networking] an instance of Hockey::Networking object
|
18
26
|
def self.create_from(hashobj, networking)
|
19
27
|
self.new hashobj, networking
|
20
28
|
end
|
21
29
|
|
30
|
+
# Construct a new instance of {App}
|
22
31
|
def initialize(hashobj, networking)
|
23
32
|
@title = hashobj['title']
|
24
33
|
@bundle_identifier = hashobj['bundle_identifier']
|
@@ -30,8 +39,8 @@ module Hockey
|
|
30
39
|
@platform = hashobj['platform']
|
31
40
|
@original_hash = hashobj
|
32
41
|
@net = networking
|
33
|
-
@
|
34
|
-
@
|
42
|
+
@cached_users = nil
|
43
|
+
@cached_versions = nil
|
35
44
|
end
|
36
45
|
|
37
46
|
def inspect
|
@@ -40,23 +49,24 @@ module Hockey
|
|
40
49
|
alias_method :to_s, :inspect
|
41
50
|
|
42
51
|
# List all users of an app on HockeyApp.
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
+
#
|
53
|
+
# @return [Array<User>] fetched {User} objects from HockeyApp.
|
54
|
+
def users(page: 1)
|
55
|
+
@cached_users ||= []
|
56
|
+
|
57
|
+
if @cached_users.empty?
|
58
|
+
obj = @net.get_object "/api/2/apps/#{@public_identifier}/app_users"
|
59
|
+
obj['app_users'].each do |hashobj|
|
60
|
+
@cached_users << User.create_from(hashobj, @net)
|
61
|
+
end
|
52
62
|
end
|
53
63
|
|
54
|
-
@
|
64
|
+
PagingArray.paginate with: @cached_users, page: page
|
55
65
|
end
|
56
66
|
|
57
67
|
# Invite a user to an app.
|
58
68
|
# return a User object.
|
59
|
-
def invite_user(email:
|
69
|
+
def invite_user(email: '')
|
60
70
|
obj = @net.post_object "/api/2/apps/#{@public_identifier}/app_users", {:email=>email, :role=>1}
|
61
71
|
|
62
72
|
user = User.create_from(obj, @net)
|
@@ -65,7 +75,7 @@ module Hockey
|
|
65
75
|
end
|
66
76
|
|
67
77
|
# Remove a user from an app on HockeyApp.
|
68
|
-
def remove_user(email:nil)
|
78
|
+
def remove_user(email: nil)
|
69
79
|
users()
|
70
80
|
user = @users.find {|u| u.email == email }
|
71
81
|
|
@@ -76,17 +86,17 @@ module Hockey
|
|
76
86
|
|
77
87
|
# List all versions of an app. The endpoint returns all versions for developer and members, but only released versions for testers.
|
78
88
|
# return an Array of Version objects.
|
79
|
-
def versions
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
def versions(page: 1)
|
90
|
+
@cached_versions ||= []
|
91
|
+
|
92
|
+
if @cached_versions.empty?
|
93
|
+
obj = @net.get_object "/api/2/apps/#{@public_identifier}/app_versions"
|
94
|
+
obj['app_versions'].each do |hashobj|
|
95
|
+
@cached_versions << Version.create_from(hashobj, @net)
|
96
|
+
end
|
87
97
|
end
|
88
98
|
|
89
|
-
@
|
99
|
+
PagingArray.paginate with: @cached_versions, page: page
|
90
100
|
end
|
91
101
|
|
92
102
|
# List all crash groups for an app.
|
@@ -96,7 +106,7 @@ module Hockey
|
|
96
106
|
# :date, :class, :number_of_crashes, :last_crash_at
|
97
107
|
# +order+ parameter:
|
98
108
|
# :asc, :desc
|
99
|
-
def crash_reasons(page: 1,
|
109
|
+
def crash_reasons(page: 1, symbolicated: true, sort: :date, order: :asc)
|
100
110
|
obj = @net.get_object "/api/2/apps/#{@public_identifier}/crash_reasons"
|
101
111
|
|
102
112
|
cr = []
|
data/lib/hockeyhelper/client.rb
CHANGED
@@ -27,11 +27,7 @@ module Hockey
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
apps.replace(@cached_apps[(page - 1) * apps.per_page, apps.per_page])
|
32
|
-
apps.update_page_with(page, @cached_apps.size)
|
33
|
-
|
34
|
-
apps
|
30
|
+
PagingArray.paginate with: @cached_apps, page: page
|
35
31
|
end
|
36
32
|
|
37
33
|
# List all teams for an account.
|
@@ -1,11 +1,22 @@
|
|
1
1
|
module Hockey
|
2
2
|
|
3
|
+
class PageRangeError < RangeError; end
|
4
|
+
|
3
5
|
class PagingArray < Array
|
4
6
|
attr_reader :current_page
|
5
7
|
attr_reader :per_page # = 25
|
6
8
|
attr_reader :total_entries
|
7
9
|
attr_reader :total_pages
|
8
10
|
|
11
|
+
def self.paginate(with: [], page: 1)
|
12
|
+
obj = self.new
|
13
|
+
obj.replace(with[(page - 1) * obj.per_page, obj.per_page])
|
14
|
+
obj.update_page_with(page, with.size)
|
15
|
+
obj
|
16
|
+
rescue
|
17
|
+
raise PageRangeError, 'your specified page is out of range in array'
|
18
|
+
end
|
19
|
+
|
9
20
|
def initialize
|
10
21
|
super
|
11
22
|
@per_page = 25
|
data/lib/hockeyhelper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hockeyhelper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Yagita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: flay
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: faraday
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|