hockeyhelper 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84b31e41e4246673cf43b1671a0fc205ac1fb816
4
- data.tar.gz: 1f10602b546ce8c5a9e304282277c50e3317456f
3
+ metadata.gz: 5c327aeb19606a5b2b3dee8d9ee6499ea8d9961c
4
+ data.tar.gz: fdc4a74ef9f44cec7449921b90c9e1df9dfb2c1f
5
5
  SHA512:
6
- metadata.gz: 600285712ac5710c9b120e29e8d088d7f9a2dd0791ccfcb226b5f1df0437625f8d858733acd3d6319d0597ce0198e361640d36ff8b2b10152b3e9096d03f7f38
7
- data.tar.gz: 1de0fbb7332569483739909115d8a14b79f7973dc46cc105d71aa5c9b2879913ccca3976e3c12f85cee91dbd0422c341b23205cc69ac08f227c07c29f42bf273
6
+ metadata.gz: d550230b9d93b87f964641ca8d7efb23ba63d2b807df87c0599f004cc46abf6691c8955e5bfde4e4e8d928c1a324b3e8dca391474a02742261c453922d605196
7
+ data.tar.gz: 6ec09c80f4df5c2ba6870f21d11e58a8b7a537d82e67337aada0d196b25bcbf582a9fde0ca5c080dc4ef22fa2b3a9f9e67b167ebf8545aa5532ab3dda5ef07ff
@@ -13,7 +13,7 @@ module Hockey
13
13
  attr_reader :platform
14
14
  attr_reader :original_hash
15
15
 
16
- attr :net, :users
16
+ attr :net
17
17
 
18
18
  def self.create_from(hashobj, networking)
19
19
  self.new hashobj, networking
@@ -31,6 +31,7 @@ module Hockey
31
31
  @original_hash = hashobj
32
32
  @net = networking
33
33
  @users = nil
34
+ @versions = nil
34
35
  end
35
36
 
36
37
  def inspect
@@ -60,6 +61,19 @@ module Hockey
60
61
  @users
61
62
  end
62
63
 
64
+ def versions
65
+ return @versions if @versions
66
+
67
+ obj = @net.get_object "/api/2/apps/#{@public_identifier}/app_versions"
68
+
69
+ @versions = []
70
+ obj['app_versions'].each do |hashobj|
71
+ @versions << Version.create_from(hashobj, @net)
72
+ end
73
+
74
+ @versions
75
+ end
76
+
63
77
  def invite_user(email:email)
64
78
  obj = @net.post_object "/api/2/apps/#{@public_identifier}/app_users", {:email=>email, :role=>1}
65
79
 
@@ -10,6 +10,7 @@ module Hockey
10
10
  def initialize(token, debug:false)
11
11
  @net = Networking.new token, debug:debug
12
12
  @apps = nil
13
+ @teams = nil
13
14
  end
14
15
 
15
16
  # return Array of App objects
@@ -26,6 +27,30 @@ module Hockey
26
27
  @apps
27
28
  end
28
29
 
30
+ # return Array of Team objects
31
+ def teams
32
+ return @teams if @teams
33
+
34
+ @teams = []
35
+ page = 1
36
+
37
+ while true
38
+ obj = @net.get_object('/api/2/teams') do |req|
39
+ req.params[:page] = page
40
+ end
41
+ obj['teams'].each do |hashobj|
42
+ @teams << Team.create_from(hashobj, @net)
43
+ end
44
+
45
+ total = obj['total_pages'].to_i
46
+ break unless page < total
47
+
48
+ page = page + 1
49
+ end
50
+
51
+ @teams
52
+ end
53
+
29
54
  # create new app on HockeyApp
30
55
  def new_app(title:title, bundle_identifier:bundle_identifier, platform: 'iOS')
31
56
  obj = @net.post_object '/api/2/apps/new', {:title=>title, :bundle_identifier=>bundle_identifier, :platform=>platform, :release_type=>0}
@@ -29,22 +29,31 @@ module Hockey
29
29
  end
30
30
  end
31
31
 
32
+ # The http wrapper for GET method to the HockayApp.
33
+ # you might give a block object if necessary.
32
34
  def get(path)
33
35
  @l.info "GET #{path}"
34
36
 
35
37
  response = @client.get do |req|
36
38
  req.url path
37
39
  req.headers['X-HockeyAppToken'] = @token
40
+ yield req if block_given?
38
41
  end
39
42
 
40
43
  response
41
44
  end
42
45
 
46
+ # The http wrapper for GET method to the HockayApp.
47
+ # you might give a block object if necessary.
48
+ # see the #get method
49
+ #
50
+ # Return the Hash object from response json.
43
51
  def get_object(path)
44
- response = get path
52
+ response = get(path)
45
53
  JSON.parse(response.body) || {}
46
54
  end
47
55
 
56
+ # The http wrapper for POST method to the HockayApp.
48
57
  def post(path, bodyhash)
49
58
  @l.info "POST #{path}, #{bodyhash}"
50
59
 
@@ -0,0 +1,30 @@
1
+ module Hockey
2
+
3
+ # Team on HockeyApp
4
+ class Team
5
+
6
+ attr_reader :id
7
+ attr_reader :name
8
+ attr_reader :original_hash
9
+
10
+ attr :net
11
+
12
+ def self.create_from(hashobj, networking)
13
+ self.new hashobj, networking
14
+ end
15
+
16
+ def initialize(hashobj, networking)
17
+ @id = hashobj['id']
18
+ @name = hashobj['name']
19
+ @original_hash = hashobj
20
+ @net = networking
21
+ end
22
+
23
+ def inspect
24
+ "#<#{self.class}:#{'0x%08x' % self.hash} #{@id}, #{@name}>"
25
+ end
26
+ alias_method :to_s, :inspect
27
+
28
+ end
29
+
30
+ end
@@ -1,3 +1,52 @@
1
1
  module Hockey
2
- VERSION = "0.0.1"
2
+
3
+ VERSION = "0.0.2"
4
+
5
+ # Version on HockeyApp
6
+ class Version
7
+
8
+ attr_reader :version
9
+ attr_reader :mandatory
10
+ attr_reader :config_url
11
+ attr_reader :download_url
12
+ attr_reader :timestamp
13
+ attr_reader :appsize
14
+ attr_reader :device_family
15
+ attr_reader :notes
16
+ attr_reader :status
17
+ attr_reader :shortversion
18
+ attr_reader :minimum_os_version
19
+ attr_reader :title
20
+ attr_reader :original_hash
21
+ attr :net
22
+
23
+ def self.create_from(hashobj, networking)
24
+ self.new hashobj, networking
25
+ end
26
+
27
+ def initialize(hashobj, networking)
28
+ @version = hashobj['version']
29
+ @mandatory = hashobj['mandatory']
30
+ @config_url = hashobj['config_url']
31
+ @download_url = hashobj['download_url']
32
+ @timestamp = hashobj['timestamp']
33
+ @appsize = hashobj['appsize']
34
+ @device_family = hashobj['device_family']
35
+ @notes = hashobj['notes']
36
+ @status = hashobj['status']
37
+ @shortversion = hashobj['shortversion']
38
+ @minimum_os_version = hashobj['minimum_os_version']
39
+ @title = hashobj['title']
40
+ @original_hash = hashobj
41
+ @net = networking
42
+ end
43
+
44
+ def inspect
45
+ "#{@title} #{@version}"
46
+ end
47
+ alias_method :to_s, :inspect
48
+
49
+ end
50
+
51
+
3
52
  end
data/lib/hockeyhelper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'hockeyhelper/app'
2
2
  require 'hockeyhelper/client'
3
3
  require 'hockeyhelper/networking'
4
+ require 'hockeyhelper/team'
4
5
  require 'hockeyhelper/user'
5
6
  require 'hockeyhelper/version'
6
7
 
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.1
4
+ version: 0.0.2
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-02-06 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,6 +70,7 @@ files:
70
70
  - lib/hockeyhelper/app.rb
71
71
  - lib/hockeyhelper/client.rb
72
72
  - lib/hockeyhelper/networking.rb
73
+ - lib/hockeyhelper/team.rb
73
74
  - lib/hockeyhelper/user.rb
74
75
  - lib/hockeyhelper/version.rb
75
76
  - spec/app_spec.rb