openstax_api 7.1.1 → 8.0.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
  SHA1:
3
- metadata.gz: db318429c83e8c7a988ce5afc23006eb0447038a
4
- data.tar.gz: 8a81f95ff5f4a951ac6ae6154d47bf3ac48ea37a
3
+ metadata.gz: a051bb3544455eda8634de89e45c437b6ffb3beb
4
+ data.tar.gz: 611263fd2da96e7c7a4b033e5211e357fd4b170a
5
5
  SHA512:
6
- metadata.gz: 6a3280616e32f8e51d258153440cb3891b4228c0c1b060e203389d132c7fdaf77118099ab9fba4f387354818d643845de146e3953e5749908a9e2f2295a681a8
7
- data.tar.gz: 9cea5a91e3b4f1973d8eeb3dfc9f61c307e2a218b80974b3aa668097c01ce384b83f10dc21e82ce2af42e2a8773835db84e121bbdecd779e3596253061a43413
6
+ metadata.gz: 8915fce828023bff8606cafbc82ace6933c0d452ecf3979d29bffedbc69cc3a66ddd1fd95af400a9c16fa65d29bce3dedb19030cf498c18e684c92358b214457
7
+ data.tar.gz: 58680b01d268abb5a04c0c33336b334b39418452b9bc2412d3140471ce6f868ff601deac127a3b9fb6a6406b7c6c4ea8837e3b6fc9ca3ce54ae80a35c83909a0
@@ -13,7 +13,7 @@ module OpenStax
13
13
  model_klass = relation.base_class
14
14
  OSU::AccessPolicy.require_action_allowed!(:index, current_api_user, model_klass)
15
15
 
16
- represent_with_options = options.merge(represent_with: represent_with)
16
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
17
17
 
18
18
  relation.each do |item|
19
19
  # Must be able to read each record
@@ -23,11 +23,11 @@ module OpenStax
23
23
  respond_with(Lev::Outputs.new(items: relation), represent_with_options)
24
24
  end
25
25
 
26
- def standard_search(model, routine, represent_with, options={})
26
+ def standard_search(klass, routine, represent_with, options={})
27
27
  user = current_api_user
28
- OSU::AccessPolicy.require_action_allowed!(:search, user, model)
28
+ OSU::AccessPolicy.require_action_allowed!(:search, user, klass)
29
29
 
30
- represent_with_options = options.merge(represent_with: represent_with)
30
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
31
31
 
32
32
  result = routine.call(params, options)
33
33
  return render_api_errors(result.errors) if result.errors.any?
@@ -42,7 +42,7 @@ module OpenStax
42
42
 
43
43
  def standard_create(model, represent_with=nil, options={})
44
44
  create_options = { status: :created, location: nil }
45
- represent_with_options = options.merge(represent_with: represent_with)
45
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
46
46
 
47
47
  model.class.transaction do
48
48
  consume!(model, represent_with_options.dup)
@@ -70,7 +70,7 @@ module OpenStax
70
70
  def standard_read(model, represent_with=nil, use_timestamp_for_cache=false, options={})
71
71
  OSU::AccessPolicy.require_action_allowed!(:read, current_api_user, model)
72
72
 
73
- represent_with_options = options.merge(represent_with: represent_with)
73
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
74
74
 
75
75
  respond_with model, represent_with_options \
76
76
  if !use_timestamp_for_cache || stale?(model, template: false)
@@ -81,7 +81,7 @@ module OpenStax
81
81
  OSU::AccessPolicy.require_action_allowed!(:update, current_api_user, model)
82
82
 
83
83
  responder_options = { responder: ResponderWithPutPatchDeleteContent }
84
- represent_with_options = options.merge(represent_with: represent_with)
84
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
85
85
 
86
86
  model.with_lock do
87
87
  consume!(model, represent_with_options.dup)
@@ -105,7 +105,7 @@ module OpenStax
105
105
  if model.respond_to?(:deleted?) && model.deleted?
106
106
 
107
107
  responder_options = { responder: ResponderWithPutPatchDeleteContent }
108
- represent_with_options = options.merge(represent_with: represent_with)
108
+ represent_with_options = { user_options: options }.merge(represent_with: represent_with)
109
109
 
110
110
  model.with_lock do
111
111
  if model.destroy
@@ -127,7 +127,8 @@ module OpenStax
127
127
  recursive = options.has_key?(:recursive) ? options[:recursive] : true
128
128
 
129
129
  responder_options = { responder: ResponderWithPutPatchDeleteContent }
130
- represent_with_options = options.except(:recursive).merge(represent_with: represent_with)
130
+ represent_with_options = { user_options: options.except(:recursive) }
131
+ .merge(represent_with: represent_with)
131
132
 
132
133
  model.with_lock do
133
134
  if model.restore(recursive: recursive)
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Api
3
- VERSION = "7.1.1"
3
+ VERSION = "8.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-17 00:00:00.000000000 Z
12
+ date: 2016-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -18,6 +18,9 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.1'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '5.0'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -25,13 +28,16 @@ dependencies:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '3.1'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: representable
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - ">="
33
39
  - !ruby/object:Gem::Version
34
- version: '2.0'
40
+ version: '2.4'
35
41
  - - "<"
36
42
  - !ruby/object:Gem::Version
37
43
  version: '4.0'
@@ -41,7 +47,7 @@ dependencies:
41
47
  requirements:
42
48
  - - ">="
43
49
  - !ruby/object:Gem::Version
44
- version: '2.0'
50
+ version: '2.4'
45
51
  - - "<"
46
52
  - !ruby/object:Gem::Version
47
53
  version: '4.0'
@@ -332,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
338
  version: '0'
333
339
  requirements: []
334
340
  rubyforge_project:
335
- rubygems_version: 2.4.6
341
+ rubygems_version: 2.6.6
336
342
  signing_key:
337
343
  specification_version: 4
338
344
  summary: API utilities for OpenStax products and tools.