bridge_api 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +14 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +4 -4
  5. data/bin/jenkins +17 -0
  6. data/bridge_api.gemspec +18 -19
  7. data/build.sh +5 -0
  8. data/docker-compose.yml +18 -0
  9. data/lib/bridge_api/api_array.rb +22 -30
  10. data/lib/bridge_api/client.rb +23 -22
  11. data/lib/bridge_api/client/account.rb +9 -0
  12. data/lib/bridge_api/client/course_template.rb +0 -2
  13. data/lib/bridge_api/client/custom_field.rb +0 -2
  14. data/lib/bridge_api/client/enrollment.rb +0 -2
  15. data/lib/bridge_api/client/live_course.rb +0 -2
  16. data/lib/bridge_api/client/live_course_enrollment.rb +0 -2
  17. data/lib/bridge_api/client/manager.rb +1 -3
  18. data/lib/bridge_api/client/role.rb +1 -3
  19. data/lib/bridge_api/client/sub_account.rb +4 -0
  20. data/lib/bridge_api/client/user.rb +15 -10
  21. data/lib/bridge_api/version.rb +1 -1
  22. data/spec/bridge_api/client/account_spec.rb +14 -0
  23. data/spec/bridge_api/client/course_template_spec.rb +1 -3
  24. data/spec/bridge_api/client/custom_field_spec.rb +4 -7
  25. data/spec/bridge_api/client/data_dump_spec.rb +1 -1
  26. data/spec/bridge_api/client/enrollment_spec.rb +3 -7
  27. data/spec/bridge_api/client/group_spec.rb +3 -3
  28. data/spec/bridge_api/client/live_course_enrollments_spec.rb +1 -1
  29. data/spec/bridge_api/client/live_course_spec.rb +2 -2
  30. data/spec/bridge_api/client/manager_spec.rb +4 -6
  31. data/spec/bridge_api/client/program_enrollment_spec.rb +1 -1
  32. data/spec/bridge_api/client/sub_account_spec.rb +2 -4
  33. data/spec/bridge_api/client/user_spec.rb +6 -9
  34. data/spec/bridge_api/client_spec.rb +7 -10
  35. data/spec/fixtures/accounts.json +129 -0
  36. data/spec/support/fake_bridge.rb +16 -9
  37. data/spec/test_helper.rb +2 -7
  38. metadata +50 -41
@@ -2,7 +2,6 @@ require 'sinatra/base'
2
2
  require 'tilt'
3
3
 
4
4
  class FakeBridge < Sinatra::Base
5
-
6
5
  ## Course Templates
7
6
 
8
7
  get %r{/api/author/course_templates$} do
@@ -102,7 +101,7 @@ class FakeBridge < Sinatra::Base
102
101
  get_json_data 200, 'enrollment.json'
103
102
  end
104
103
 
105
- #Custom Fields
104
+ # Custom Fields
106
105
 
107
106
  get %r{/api/author/custom_fields} do
108
107
  get_json_data 200, 'custom_fields.json'
@@ -148,31 +147,39 @@ class FakeBridge < Sinatra::Base
148
147
  get_json_data 200, 'group.json'
149
148
  end
150
149
 
151
- #Live Courses
150
+ # Live Courses
152
151
  get %r{/api/author/live_courses$} do
153
152
  get_json_data 200, 'live_courses.json'
154
153
  end
155
154
 
156
- #Live Course Enrollments
155
+ # Live Course Enrollments
157
156
  get %r{/api/author/live_courses/\d+/learners} do
158
157
  get_json_data 200, 'live_course_enrollments.json'
159
158
  end
160
159
 
161
- #Sub Accounts
160
+ # Sub Accounts
162
161
  get %r{/api/admin/sub_accounts} do
163
162
  get_json_data 200, 'sub_accounts.json'
164
163
  end
165
164
 
165
+ put %r{/api/admin/sub_accounts} do
166
+ get_json_data 200, 'sub_accounts.json'
167
+ end
168
+
169
+ # Accounts
170
+ put %r{/api/support/accounts} do
171
+ get_json_data 200, 'accounts.json'
172
+ end
173
+
166
174
  private
167
175
 
168
176
  def get_json_data(response_code, file_name)
169
177
  content_type :json
170
178
  status response_code
171
- unless file_name.nil?
172
- File.open(File.dirname(__FILE__) + '/../fixtures/' + file_name).read
173
- else
179
+ if file_name.nil?
174
180
  {}
181
+ else
182
+ File.open(File.dirname(__FILE__) + '/../fixtures/' + file_name).read
175
183
  end
176
184
  end
177
-
178
185
  end
@@ -5,7 +5,7 @@ require 'json'
5
5
  require 'pry'
6
6
 
7
7
  RSpec.configure do |config|
8
- Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
8
+ Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
9
9
 
10
10
  config.before(:each) do
11
11
  WebMock.disable_net_connect!
@@ -13,11 +13,6 @@ RSpec.configure do |config|
13
13
  end
14
14
  end
15
15
 
16
-
17
16
  def fixture(*file)
18
- File.new(File.join(File.expand_path("../fixtures", __FILE__), *file))
17
+ File.new(File.join(File.expand_path('fixtures', __dir__), *file))
19
18
  end
20
-
21
-
22
-
23
-
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -45,35 +31,35 @@ dependencies:
45
31
  - !ruby/object:Gem::Version
46
32
  version: 1.0.0
47
33
  - !ruby/object:Gem::Dependency
48
- name: rspec
34
+ name: byebug
49
35
  requirement: !ruby/object:Gem::Requirement
50
36
  requirements:
51
37
  - - "~>"
52
38
  - !ruby/object:Gem::Version
53
- version: '2.6'
39
+ version: 8.2.2
54
40
  type: :development
55
41
  prerelease: false
56
42
  version_requirements: !ruby/object:Gem::Requirement
57
43
  requirements:
58
44
  - - "~>"
59
45
  - !ruby/object:Gem::Version
60
- version: '2.6'
46
+ version: 8.2.2
61
47
  - !ruby/object:Gem::Dependency
62
- name: webmock
48
+ name: pry
63
49
  requirement: !ruby/object:Gem::Requirement
64
50
  requirements:
65
51
  - - "~>"
66
52
  - !ruby/object:Gem::Version
67
- version: 1.22.6
53
+ version: '0'
68
54
  type: :development
69
55
  prerelease: false
70
56
  version_requirements: !ruby/object:Gem::Requirement
71
57
  requirements:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
- version: 1.22.6
60
+ version: '0'
75
61
  - !ruby/object:Gem::Dependency
76
- name: pry
62
+ name: rake
77
63
  requirement: !ruby/object:Gem::Requirement
78
64
  requirements:
79
65
  - - "~>"
@@ -87,25 +73,19 @@ dependencies:
87
73
  - !ruby/object:Gem::Version
88
74
  version: '0'
89
75
  - !ruby/object:Gem::Dependency
90
- name: tilt
76
+ name: rspec
91
77
  requirement: !ruby/object:Gem::Requirement
92
78
  requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: 1.3.4
96
79
  - - "~>"
97
80
  - !ruby/object:Gem::Version
98
- version: '1.3'
81
+ version: '2.6'
99
82
  type: :development
100
83
  prerelease: false
101
84
  version_requirements: !ruby/object:Gem::Requirement
102
85
  requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: 1.3.4
106
86
  - - "~>"
107
87
  - !ruby/object:Gem::Version
108
- version: '1.3'
88
+ version: '2.6'
109
89
  - !ruby/object:Gem::Dependency
110
90
  name: sinatra
111
91
  requirement: !ruby/object:Gem::Requirement
@@ -121,33 +101,39 @@ dependencies:
121
101
  - !ruby/object:Gem::Version
122
102
  version: '1.0'
123
103
  - !ruby/object:Gem::Dependency
124
- name: byebug
104
+ name: tilt
125
105
  requirement: !ruby/object:Gem::Requirement
126
106
  requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.4
127
110
  - - "~>"
128
111
  - !ruby/object:Gem::Version
129
- version: 8.2.2
112
+ version: '1.3'
130
113
  type: :development
131
114
  prerelease: false
132
115
  version_requirements: !ruby/object:Gem::Requirement
133
116
  requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 1.3.4
134
120
  - - "~>"
135
121
  - !ruby/object:Gem::Version
136
- version: 8.2.2
122
+ version: '1.3'
137
123
  - !ruby/object:Gem::Dependency
138
- name: footrest
124
+ name: webmock
139
125
  requirement: !ruby/object:Gem::Requirement
140
126
  requirements:
141
- - - ">="
127
+ - - "~>"
142
128
  - !ruby/object:Gem::Version
143
- version: 0.5.1
144
- type: :runtime
129
+ version: 1.22.6
130
+ type: :development
145
131
  prerelease: false
146
132
  version_requirements: !ruby/object:Gem::Requirement
147
133
  requirements:
148
- - - ">="
134
+ - - "~>"
149
135
  - !ruby/object:Gem::Version
150
- version: 0.5.1
136
+ version: 1.22.6
151
137
  - !ruby/object:Gem::Dependency
152
138
  name: faraday
153
139
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +162,20 @@ dependencies:
176
162
  - - "~>"
177
163
  - !ruby/object:Gem::Version
178
164
  version: 0.9.0
165
+ - !ruby/object:Gem::Dependency
166
+ name: footrest
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: 0.5.1
172
+ type: :runtime
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: 0.5.1
179
179
  description: Ruby gem for interacting with the bridge API
180
180
  email:
181
181
  - jshaffer@instructure.com
@@ -184,12 +184,17 @@ extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
186
  - ".gitignore"
187
+ - Dockerfile
187
188
  - Gemfile
188
189
  - Gemfile.lock
190
+ - bin/jenkins
189
191
  - bridge_api.gemspec
192
+ - build.sh
193
+ - docker-compose.yml
190
194
  - lib/bridge_api.rb
191
195
  - lib/bridge_api/api_array.rb
192
196
  - lib/bridge_api/client.rb
197
+ - lib/bridge_api/client/account.rb
193
198
  - lib/bridge_api/client/course_template.rb
194
199
  - lib/bridge_api/client/custom_field.rb
195
200
  - lib/bridge_api/client/data_dump.rb
@@ -203,6 +208,7 @@ files:
203
208
  - lib/bridge_api/client/sub_account.rb
204
209
  - lib/bridge_api/client/user.rb
205
210
  - lib/bridge_api/version.rb
211
+ - spec/bridge_api/client/account_spec.rb
206
212
  - spec/bridge_api/client/course_template_spec.rb
207
213
  - spec/bridge_api/client/custom_field_spec.rb
208
214
  - spec/bridge_api/client/data_dump_spec.rb
@@ -215,6 +221,7 @@ files:
215
221
  - spec/bridge_api/client/sub_account_spec.rb
216
222
  - spec/bridge_api/client/user_spec.rb
217
223
  - spec/bridge_api/client_spec.rb
224
+ - spec/fixtures/accounts.json
218
225
  - spec/fixtures/course.json
219
226
  - spec/fixtures/courses.json
220
227
  - spec/fixtures/custom_fields.json
@@ -259,6 +266,7 @@ signing_key:
259
266
  specification_version: 4
260
267
  summary: Bridge API
261
268
  test_files:
269
+ - spec/bridge_api/client/account_spec.rb
262
270
  - spec/bridge_api/client/course_template_spec.rb
263
271
  - spec/bridge_api/client/custom_field_spec.rb
264
272
  - spec/bridge_api/client/data_dump_spec.rb
@@ -271,6 +279,7 @@ test_files:
271
279
  - spec/bridge_api/client/sub_account_spec.rb
272
280
  - spec/bridge_api/client/user_spec.rb
273
281
  - spec/bridge_api/client_spec.rb
282
+ - spec/fixtures/accounts.json
274
283
  - spec/fixtures/course.json
275
284
  - spec/fixtures/courses.json
276
285
  - spec/fixtures/custom_fields.json