bridge_api 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ODM5NDY4YjliNjZlMmRlZGU2OTFhNTAzMDQ5YjU4ZGNkNDQyZjI3YQ==
5
- data.tar.gz: !binary |-
6
- NTM4NTM0ZmNiNzBjMWE5YmQxODBlZWMyMDJhYTZjOTM1M2MyNjgwOQ==
2
+ SHA1:
3
+ metadata.gz: fff6d7e4f40afd6489e00f363522839bc555c81e
4
+ data.tar.gz: 72b1516f3a3b45ac7b25aad4d700fbb8b9dfd6cb
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YmU4MjZjNTExNjQwODhiOTJkOTAzY2Q2ZmUzODljNWYxY2ZiN2RkOGNiMzIz
10
- MjkyOGY4MzMzNTRiOGI3YTQ0ZWYyNmRkY2YyY2VlNTQ5ZTdlNDJkYjc1ZjQ5
11
- OGYzYjA4YTVmMDA0NTc3OTI3MWU3ZTEzZTE3ZTI2MDRmYmM1YWM=
12
- data.tar.gz: !binary |-
13
- MDY5MDQ1NWRmYWFkYzllOTQzYjk4NGE4ZmE1NzcxODRiMzNlNWMwNzI5MWU4
14
- YmE0Y2U1NzdmMGY5M2JhYzEzZjc4NjMzZjQ3OTJmMmNhZjY3ZDUwZTc1ZTNj
15
- Zjc3NDk5NmE1ODIyMTFhNDFmOGNhYTNlMzJhOWIzMWVmNzU2MDM=
6
+ metadata.gz: c3a18e535a948c4f25a9fb4969673b2ea4bdf9d25d9129f7f3a3889b21b3950faf5db1d731458b00cf18403d95fd9ee8c0870138af7c4579c074457fdf062bed
7
+ data.tar.gz: 644f45595347fa9e6372e1c085b0d99c0655f6da5a31de9d0fdf6ec79cb538975712756f5b90c029466157e6d92e90c1a36db6469b0927f158edb79d2a52d0c6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bridge_api (0.0.9)
4
+ bridge_api (0.0.10)
5
5
  faraday (~> 0.9.0)
6
6
  faraday_middleware (~> 0.9.0)
7
7
  footrest (>= 0.5.1)
@@ -9,15 +9,15 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (4.2.6)
12
+ activesupport (5.0.2)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
14
  i18n (~> 0.7)
14
- json (~> 1.7, >= 1.7.7)
15
15
  minitest (~> 5.1)
16
- thread_safe (~> 0.3, >= 0.3.4)
17
16
  tzinfo (~> 1.1)
18
17
  addressable (2.4.0)
19
18
  byebug (8.2.2)
20
19
  coderay (1.1.1)
20
+ concurrent-ruby (1.0.5)
21
21
  crack (0.4.3)
22
22
  safe_yaml (~> 1.0.0)
23
23
  diff-lcs (1.2.5)
@@ -30,11 +30,10 @@ GEM
30
30
  faraday (~> 0.9.0)
31
31
  link_header (>= 0.0.7)
32
32
  hashdiff (0.2.3)
33
- i18n (0.7.0)
34
- json (1.8.3)
33
+ i18n (0.8.1)
35
34
  link_header (0.0.8)
36
35
  method_source (0.8.2)
37
- minitest (5.8.4)
36
+ minitest (5.10.1)
38
37
  multipart-post (2.0.0)
39
38
  pry (0.10.3)
40
39
  coderay (~> 1.1.0)
@@ -54,7 +53,7 @@ GEM
54
53
  sinatra (1.0)
55
54
  rack (>= 1.0)
56
55
  slop (3.6.0)
57
- thread_safe (0.3.5)
56
+ thread_safe (0.3.6)
58
57
  tilt (1.4.1)
59
58
  tzinfo (1.2.2)
60
59
  thread_safe (~> 0.1)
@@ -78,4 +77,4 @@ DEPENDENCIES
78
77
  webmock (~> 1.22.6)
79
78
 
80
79
  BUNDLED WITH
81
- 1.11.2
80
+ 1.13.7
@@ -100,13 +100,15 @@ module BridgeAPI
100
100
  end
101
101
 
102
102
  def get_response_content(response)
103
- if response.body.is_a?(Hash)
104
- content = response.body.reject{|k, v| META_FIELDS.include?(k)}
105
- if content.length > 0
106
- return content.values[0]
107
- end
103
+ return [] unless response.body.is_a?(Hash)
104
+ content = response.body.reject{|k, v| META_FIELDS.include?(k)}
105
+ if content.length > 1
106
+ content
107
+ elsif content.length == 1
108
+ content.values[0]
109
+ else
110
+ []
108
111
  end
109
- []
110
112
  end
111
113
 
112
114
  def apply_response_metadata(response, concat = true)
@@ -14,6 +14,7 @@ module BridgeAPI
14
14
  COURSE_TEMPLATE_PATH = '/course_templates'
15
15
  ENROLLMENT_PATH = '/enrollments'
16
16
  USER_PATH = '/users'
17
+ MANAGER_PATH = '/managers'
17
18
  ADMIN_PATH = "/admin"
18
19
  AUTHOR_PATH = "/author"
19
20
  LEARNER_PATH = "/learner"
@@ -28,6 +29,7 @@ module BridgeAPI
28
29
  include CourseTemplate
29
30
  include Enrollment
30
31
  include User
32
+ include Manager
31
33
  include CustomField
32
34
  include Footrest
33
35
 
@@ -0,0 +1,15 @@
1
+ module BridgeAPI
2
+ class Client
3
+ module Manager
4
+
5
+ def get_all_managers(params = {})
6
+ get("#{API_PATH}#{AUTHOR_PATH}#{MANAGER_PATH}", params)
7
+ end
8
+
9
+ def get_manager_direct_reports(manager_id, params = {})
10
+ get("#{API_PATH}#{AUTHOR_PATH}#{MANAGER_PATH}/#{manager_id}/direct_reports", params)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module BridgeAPI
2
- VERSION = '0.0.9' unless defined?(BridgeAPI::VERSION)
2
+ VERSION = '0.0.10' unless defined?(BridgeAPI::VERSION)
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ describe BridgeAPI::Client::User do
4
+
5
+ before do
6
+ @client = BridgeAPI::Client.new(prefix: "http://test.bridge.com", token: "test_token")
7
+ end
8
+
9
+ it 'should get all managers' do
10
+ response = @client.get_all_managers
11
+ expect(response.first['id']).to(eq("17"))
12
+ end
13
+
14
+ it 'should get all the people who report to a manager' do
15
+ response = @client.get_manager_direct_reports(17)
16
+ expect(response['direct_reports'].count).to(eq(2))
17
+ expect(response['direct_reports'].first['id']).to(eq("3"))
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,55 @@
1
+ {
2
+ "meta": {
3
+
4
+ },
5
+ "manager_id": "17",
6
+ "direct_reports_count": 2,
7
+ "direct_reports": [
8
+ {
9
+ "id": "3",
10
+ "uid": "bridge testuser2",
11
+ "hris_id": null,
12
+ "first_name": null,
13
+ "last_name": null,
14
+ "full_name": null,
15
+ "sortable_name": null,
16
+ "email": "",
17
+ "locale": "en",
18
+ "roles": [
19
+
20
+ ],
21
+ "name": "bridge testuser2",
22
+ "avatar_url": null,
23
+ "updated_at": "2017-03-08T14:52:12.363-07:00",
24
+ "deleted_at": null,
25
+ "unsubscribed": null,
26
+ "welcomed_at": null,
27
+ "logged_in_at": null,
28
+ "hire_date": null,
29
+ "is_manager": false
30
+ },
31
+ {
32
+ "id": "5",
33
+ "uid": "bridgetestuser@test.com",
34
+ "hris_id": null,
35
+ "first_name": "Bridge",
36
+ "last_name": "TestUser",
37
+ "full_name": null,
38
+ "sortable_name": "",
39
+ "email": "bridgetestuser@test.com",
40
+ "locale": "en",
41
+ "roles": [
42
+
43
+ ],
44
+ "name": "bridgetestuser@test.com",
45
+ "avatar_url": null,
46
+ "updated_at": "2017-03-08T15:08:46.454-07:00",
47
+ "deleted_at": null,
48
+ "unsubscribed": null,
49
+ "welcomed_at": null,
50
+ "logged_in_at": null,
51
+ "hire_date": null,
52
+ "is_manager": false
53
+ }
54
+ ]
55
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "meta": {
3
+
4
+ },
5
+ "managers": [
6
+ {
7
+ "id": "17",
8
+ "uid": "John.Smith@test.com",
9
+ "hris_id": null,
10
+ "first_name": null,
11
+ "last_name": null,
12
+ "full_name": null,
13
+ "sortable_name": null,
14
+ "email": "John.Smith@test.com",
15
+ "locale": "en",
16
+ "roles": [
17
+ "observer"
18
+ ],
19
+ "name": "John.Smith@test.com",
20
+ "avatar_url": null,
21
+ "updated_at": "2017-03-08T14:55:36.743-07:00",
22
+ "deleted_at": null,
23
+ "unsubscribed": null,
24
+ "welcomed_at": null,
25
+ "logged_in_at": null,
26
+ "hire_date": null,
27
+ "direct_reports_count": 8
28
+ },
29
+ {
30
+ "id": "6",
31
+ "uid": "Steve.Perry@test.com",
32
+ "hris_id": null,
33
+ "first_name": null,
34
+ "last_name": null,
35
+ "full_name": null,
36
+ "sortable_name": null,
37
+ "email": "Steve.Perry@test.com",
38
+ "locale": "en",
39
+ "roles": [
40
+ "observer"
41
+ ],
42
+ "name": "Steve.Perry@test.com",
43
+ "avatar_url": null,
44
+ "updated_at": "2017-03-08T14:52:17.809-07:00",
45
+ "deleted_at": null,
46
+ "unsubscribed": null,
47
+ "welcomed_at": null,
48
+ "logged_in_at": null,
49
+ "hire_date": null,
50
+ "direct_reports_count": 9
51
+ }
52
+ ]
53
+ }
@@ -57,6 +57,15 @@ class FakeBridge < Sinatra::Base
57
57
  get_json_data 204, nil
58
58
  end
59
59
 
60
+ ## Managers
61
+ get %r{/api/author/managers$} do
62
+ get_json_data 200, 'managers.json'
63
+ end
64
+
65
+ get %r{/api/author/managers/\d+/direct_reports$} do
66
+ get_json_data 200, 'direct_reports.json'
67
+ end
68
+
60
69
  ## Enrollments
61
70
 
62
71
  post %r{/api/author/course_templates/\d+/enrollments$} do
metadata CHANGED
@@ -1,179 +1,179 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
- - - ! '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.0.0
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ~>
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.0'
44
- - - ! '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.0.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ~>
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '2.6'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ~>
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.6'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: webmock
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: 1.22.6
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.22.6
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: pry
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: tilt
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ! '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 1.3.4
96
- - - ~>
96
+ - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '1.3'
99
99
  type: :development
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ! '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: 1.3.4
106
- - - ~>
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '1.3'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: sinatra
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ~>
113
+ - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '1.0'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - ~>
120
+ - - "~>"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '1.0'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: byebug
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ~>
127
+ - - "~>"
128
128
  - !ruby/object:Gem::Version
129
129
  version: 8.2.2
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ~>
134
+ - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: 8.2.2
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: footrest
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ! '>='
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: 0.5.1
144
144
  type: :runtime
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ! '>='
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: 0.5.1
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: faraday
153
153
  requirement: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - ~>
155
+ - - "~>"
156
156
  - !ruby/object:Gem::Version
157
157
  version: 0.9.0
158
158
  type: :runtime
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
- - - ~>
162
+ - - "~>"
163
163
  - !ruby/object:Gem::Version
164
164
  version: 0.9.0
165
165
  - !ruby/object:Gem::Dependency
166
166
  name: faraday_middleware
167
167
  requirement: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ~>
169
+ - - "~>"
170
170
  - !ruby/object:Gem::Version
171
171
  version: 0.9.0
172
172
  type: :runtime
173
173
  prerelease: false
174
174
  version_requirements: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ~>
176
+ - - "~>"
177
177
  - !ruby/object:Gem::Version
178
178
  version: 0.9.0
179
179
  description: Ruby gem for interacting with the bridge API
@@ -183,7 +183,7 @@ executables: []
183
183
  extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
- - .gitignore
186
+ - ".gitignore"
187
187
  - Gemfile
188
188
  - Gemfile.lock
189
189
  - bridge_api.gemspec
@@ -193,18 +193,22 @@ files:
193
193
  - lib/bridge_api/client/course_template.rb
194
194
  - lib/bridge_api/client/custom_field.rb
195
195
  - lib/bridge_api/client/enrollment.rb
196
+ - lib/bridge_api/client/manager.rb
196
197
  - lib/bridge_api/client/user.rb
197
198
  - lib/bridge_api/version.rb
198
199
  - spec/bridge_api/client/course_template_spec.rb
199
200
  - spec/bridge_api/client/custom_field_spec.rb
200
201
  - spec/bridge_api/client/enrollment_spec.rb
202
+ - spec/bridge_api/client/manager_spec.rb
201
203
  - spec/bridge_api/client/user_spec.rb
202
204
  - spec/bridge_api/client_spec.rb
203
205
  - spec/fixtures/course.json
204
206
  - spec/fixtures/courses.json
205
207
  - spec/fixtures/custom_fields.json
208
+ - spec/fixtures/direct_reports.json
206
209
  - spec/fixtures/enrollment.json
207
210
  - spec/fixtures/enrollments.json
211
+ - spec/fixtures/managers.json
208
212
  - spec/fixtures/programs.json
209
213
  - spec/fixtures/user.json
210
214
  - spec/fixtures/users.json
@@ -220,17 +224,17 @@ require_paths:
220
224
  - lib
221
225
  required_ruby_version: !ruby/object:Gem::Requirement
222
226
  requirements:
223
- - - ! '>='
227
+ - - ">="
224
228
  - !ruby/object:Gem::Version
225
229
  version: '0'
226
230
  required_rubygems_version: !ruby/object:Gem::Requirement
227
231
  requirements:
228
- - - ! '>='
232
+ - - ">="
229
233
  - !ruby/object:Gem::Version
230
234
  version: '0'
231
235
  requirements: []
232
236
  rubyforge_project:
233
- rubygems_version: 2.4.7
237
+ rubygems_version: 2.5.1
234
238
  signing_key:
235
239
  specification_version: 4
236
240
  summary: Bridge API
@@ -238,13 +242,16 @@ test_files:
238
242
  - spec/bridge_api/client/course_template_spec.rb
239
243
  - spec/bridge_api/client/custom_field_spec.rb
240
244
  - spec/bridge_api/client/enrollment_spec.rb
245
+ - spec/bridge_api/client/manager_spec.rb
241
246
  - spec/bridge_api/client/user_spec.rb
242
247
  - spec/bridge_api/client_spec.rb
243
248
  - spec/fixtures/course.json
244
249
  - spec/fixtures/courses.json
245
250
  - spec/fixtures/custom_fields.json
251
+ - spec/fixtures/direct_reports.json
246
252
  - spec/fixtures/enrollment.json
247
253
  - spec/fixtures/enrollments.json
254
+ - spec/fixtures/managers.json
248
255
  - spec/fixtures/programs.json
249
256
  - spec/fixtures/user.json
250
257
  - spec/fixtures/users.json