connector_kit 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08bee81ea565559ab0b8e5156e8149c00d42c75a16006ac8286b8d9e9caf91aa'
4
- data.tar.gz: 4f5ca61f4feac8042d710debefed0db9ed857c389d5ee1b22bb81d67966fdd5c
3
+ metadata.gz: 16c791cdd89b42d52821395c5cde38ee8b7d409eeb9a4b4f478ff21bcf5d3af0
4
+ data.tar.gz: f63ac876d2a8e43966b4248d0f439819e364823b06311b97890b21ddae0d0d0d
5
5
  SHA512:
6
- metadata.gz: f0ed6058f0cea7ad567120bb4a5c75463134cc8e3b19790a931f06ac7fc9209d59d02686ad72a5e4dcc0f4a70370a04b687bb07e3ac7c59ae8c4815afe1c6434
7
- data.tar.gz: fb0c640fc46f104d502f856efc9ab4d736b06f6610dba75eb6f6ef63e6e5b2889382e1030a21f63450c4df4cdf6cb7f0081c8cf69066009fb2f04ed87dadb2f6
6
+ metadata.gz: 1bae52d5bc60eef1c3bae201bc97388dd8d7880f752ba3ffa6fdf941d4946afa0de1370a690a76ca0f3399ad73db47a5f10ddab18943472f33971331d3dbbfb0
7
+ data.tar.gz: d020a6f1042b6fbf953bcbd1921d623e19cc5dbec9d8a06203d87122d05a1bed111ffecc7f1aaa96f4bf194581a87d4a0a546bdf652f0c38b08a0a56b8cfeb0d
data/lib/connector_kit.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'connector_kit/httpclient.rb'
2
2
  require 'connector_kit/token_generator'
3
3
  require 'connector_kit/version'
4
- require 'connector_kit/mappers/app_list_mapper'
5
- require 'connector_kit/mappers/build_list_mapper'
6
- require 'connector_kit/mappers/build_details_mapper'
4
+ require 'connector_kit/mappers/app_list_response_mapper'
5
+ require 'connector_kit/mappers/user_list_response_mapper'
6
+ require 'connector_kit/mappers/build_list_response_mapper'
7
+ require 'connector_kit/mappers/build_details_response_mapper'
7
8
 
8
9
  module ConnectorKit
9
10
  # Class used for communicating with the App Store Connect API
@@ -22,15 +23,22 @@ module ConnectorKit
22
23
  end
23
24
 
24
25
  def apps
25
- @httpclient.get '/apps', AppListMapper.new
26
+ @httpclient.get '/apps', AppListResponseMapper.new
27
+ end
28
+
29
+ def users
30
+ @httpclient.get '/users', UserListResponseMapper.new
26
31
  end
27
32
 
28
33
  def app_builds(app)
29
- @httpclient.get "/apps/#{app.id}/builds", BuildListMapper.new
34
+ @httpclient.get "/apps/#{app.id}/builds", BuildListResponseMapper.new
30
35
  end
31
36
 
32
37
  def build_beta_details(build)
33
- @httpclient.get "/buildBetaDetails/#{build.id}", BuildDetailsMapper.new
38
+ @httpclient.get(
39
+ "/buildBetaDetails/#{build.id}",
40
+ BuildDetailsResponseMapper.new
41
+ )
34
42
  end
35
43
  end
36
44
  end
@@ -2,7 +2,7 @@ require 'connector_kit/models/app'
2
2
 
3
3
  module ConnectorKit
4
4
  # Mapper between a HTTParty response and a list of Apps
5
- class AppListMapper
5
+ class AppListResponseMapper
6
6
  def map(data)
7
7
  data.map { |app| App.new(app) }
8
8
  end
@@ -2,7 +2,7 @@ require 'connector_kit/models/build_details'
2
2
 
3
3
  module ConnectorKit
4
4
  # Mapper between a HTTParty response and a BuildDetails object
5
- class BuildDetailsMapper
5
+ class BuildDetailsResponseMapper
6
6
  def map(data)
7
7
  BuildDetails.new(data)
8
8
  end
@@ -2,7 +2,7 @@ require 'connector_kit/models/build'
2
2
 
3
3
  module ConnectorKit
4
4
  # Mapper between a HTTParty response and a list of Builds
5
- class BuildListMapper
5
+ class BuildListResponseMapper
6
6
  def map(data)
7
7
  data.map { |build| Build.new(build) }
8
8
  end
@@ -0,0 +1,10 @@
1
+ require 'connector_kit/models/user'
2
+
3
+ module ConnectorKit
4
+ # Mapper between a HTTParty response and a list of Users
5
+ class UserListResponseMapper
6
+ def map(data)
7
+ data.map { |user| User.new(user) }
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,12 @@
1
+ require 'connector_kit/models/model'
2
+
1
3
  module ConnectorKit
2
- # Simple model class for representing Apps in the App Store Connect API
3
- class App
4
- attr_reader :id, :bundle_id, :name, :sku
4
+ # Simple model class for representing Apps
5
+ class App < Model
6
+ attr_reader :bundle_id, :name, :sku
5
7
 
6
8
  def initialize(options)
7
- @id = options['id']
9
+ super(options)
8
10
 
9
11
  attrs = options['attributes']
10
12
  @bundle_id = attrs['bundleId']
@@ -1,15 +1,16 @@
1
+ require 'connector_kit/models/model'
2
+
1
3
  module ConnectorKit
2
- # Simple model class for representing Builds in the App Store Connect API
3
- class Build
4
- attr_reader :id,
5
- :expired,
4
+ # Simple model class for representing Builds
5
+ class Build < Model
6
+ attr_reader :expired,
6
7
  :processing_state,
7
8
  :version,
8
9
  :uploaded_date,
9
10
  :expiration_date
10
11
 
11
12
  def initialize(options)
12
- @id = options['id']
13
+ super(options)
13
14
 
14
15
  attrs = options['attributes']
15
16
  @expired = attrs['expired']
@@ -1,10 +1,12 @@
1
+ require 'connector_kit/models/model'
2
+
1
3
  module ConnectorKit
2
- # Simple model class for representing Build details in the App Store Connect API
3
- class BuildDetails
4
- attr_reader :id, :external_build_state, :internal_build_state
4
+ # Simple model class for representing Build details
5
+ class BuildDetails < Model
6
+ attr_reader :external_build_state, :internal_build_state
5
7
 
6
8
  def initialize(options)
7
- @id = options['id']
9
+ super(options)
8
10
 
9
11
  attrs = options['attributes']
10
12
  @external_build_state = attrs['externalBuildState']
@@ -0,0 +1,10 @@
1
+ module ConnectorKit
2
+ # Base model for representing different entities
3
+ class Model
4
+ attr_reader :id
5
+
6
+ def initialize(options)
7
+ @id = options['id']
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ require 'connector_kit/models/model'
2
+
3
+ module ConnectorKit
4
+ # Simple model class for representing Users in the App Store Connect API
5
+ class User < Model
6
+ attr_reader :first_name, :last_name, :username, :roles, :all_apps_visible
7
+
8
+ def initialize(options)
9
+ super(options)
10
+
11
+ attrs = options['attributes']
12
+ @first_name = attrs['firstName']
13
+ @last_name = attrs['lastName']
14
+ @username = attrs['username']
15
+ @all_apps_visible = attrs['allAppsVisible']
16
+ @roles = attrs['roles'].map { |role| role.downcase.to_sym }
17
+ end
18
+
19
+ def full_name
20
+ "#{@first_name} #{@last_name}"
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module ConnectorKit
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connector_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Jarbrant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-18 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,12 +108,15 @@ files:
108
108
  - lib/connector_kit.rb
109
109
  - lib/connector_kit/exceptions.rb
110
110
  - lib/connector_kit/httpclient.rb
111
- - lib/connector_kit/mappers/app_list_mapper.rb
112
- - lib/connector_kit/mappers/build_details_mapper.rb
113
- - lib/connector_kit/mappers/build_list_mapper.rb
111
+ - lib/connector_kit/mappers/app_list_response_mapper.rb
112
+ - lib/connector_kit/mappers/build_details_response_mapper.rb
113
+ - lib/connector_kit/mappers/build_list_response_mapper.rb
114
+ - lib/connector_kit/mappers/user_list_response_mapper.rb
114
115
  - lib/connector_kit/models/app.rb
115
116
  - lib/connector_kit/models/build.rb
116
117
  - lib/connector_kit/models/build_details.rb
118
+ - lib/connector_kit/models/model.rb
119
+ - lib/connector_kit/models/user.rb
117
120
  - lib/connector_kit/token_generator.rb
118
121
  - lib/connector_kit/version.rb
119
122
  - spec/connector_kit_spec.rb