openstax_api 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/openstax/api/representable_schema_printer.rb +12 -8
- data/lib/openstax/api/version.rb +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTUwZDUyZTY1MGJkYjZmZmNjOGM0M2EyOTNiOTQzY2NiNmQ4OGFiMg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b231f4fe7bbe6bc67f34fa2637da5e0f3c2325fc
|
4
|
+
data.tar.gz: 5ce984b6ba226fbb512c1bb97801d0d1d473a1aa
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZGU2NjA3MDg0OGUzM2Y5ZjVlOGVhOTJmOWU4NjlkYjczZGRiYzRlNzk0Y2Fj
|
11
|
-
OTQzMjY3OTQ3NzViNjAxOGQ1OGE3NmFmOWZmNmIyMjY2NDhmMGE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGNiMjNiN2FjY2Q4ODhjOGY2NmVmMTI3MGE1N2QxMWY1ZWI4NjdhMDcyMjEz
|
14
|
-
YWYwZTRhZGJiZjVjYTZlNmIzNWRiM2YyZjk5NmQ2Mzk1MDFhYjM1NzJlYzMx
|
15
|
-
ZTdlOTNkYTM5ZjgyNjQyYTI4N2ZlZmI2NjExODE2YjU4MjU1Y2I=
|
6
|
+
metadata.gz: ec2163352de2501e65b8cd2edfcebc40f8aec79631102bfedfe7b575cb955f3b4c623769aa7531c4ef8f5ea5f4463a64949d91261d16e93a0f26bc41e538926b
|
7
|
+
data.tar.gz: d9cf3bc205e742f0a30ab2b878ca5cf6eb95c9bbd1aa86e02e3bca82367c3881d630f03cc79017cb41e348a262f1a4fcc9e2e7193eeddb8a69ec2524e2000fa3
|
@@ -2,6 +2,13 @@ module OpenStax
|
|
2
2
|
module Api
|
3
3
|
class RepresentableSchemaPrinter
|
4
4
|
|
5
|
+
def self.json_schema(representer, options = {})
|
6
|
+
definitions = {}
|
7
|
+
schema = json_object(representer, definitions, options)
|
8
|
+
schema[:definitions] = definitions unless definitions.blank?
|
9
|
+
schema
|
10
|
+
end
|
11
|
+
|
5
12
|
def self.json(representer, options={})
|
6
13
|
options[:include] ||= [:readable, :writeable]
|
7
14
|
|
@@ -35,7 +42,7 @@ module OpenStax
|
|
35
42
|
|
36
43
|
# Skip unless attr includes the specified key or is required
|
37
44
|
next unless [options[:include]].flatten.any?{ |inc|
|
38
|
-
attr
|
45
|
+
attr[inc]} || schema_info[:required]
|
39
46
|
|
40
47
|
# Guess a default type based on the attribute name
|
41
48
|
type = attr[:type].to_s.downcase
|
@@ -45,6 +52,10 @@ module OpenStax
|
|
45
52
|
|
46
53
|
schema_info.each do |key, value|
|
47
54
|
next if key == :required
|
55
|
+
if key == :definitions
|
56
|
+
definitions.merge!(value)
|
57
|
+
next
|
58
|
+
end
|
48
59
|
value = value.to_s.downcase if key == :type
|
49
60
|
attr_info[key] = value
|
50
61
|
end
|
@@ -85,13 +96,6 @@ module OpenStax
|
|
85
96
|
schema
|
86
97
|
end
|
87
98
|
|
88
|
-
def self.json_schema(representer, options = {})
|
89
|
-
definitions = {}
|
90
|
-
schema = json_object(representer, definitions, options)
|
91
|
-
schema[:definitions] = definitions unless definitions.blank?
|
92
|
-
schema
|
93
|
-
end
|
94
|
-
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
data/lib/openstax/api/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
@@ -9,132 +9,132 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.1'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.1'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: representable
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.8'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.8'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: roar
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 0.12.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.12.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: roar-rails
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.1.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 0.1.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: doorkeeper
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0.5'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0.5'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: openstax_utilities
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 1.0.1
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 1.0.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: exception_notification
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '4.0'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '4.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: sqlite3
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - ~>
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '1.3'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '1.3'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rspec-rails
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - ~>
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '2.14'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - ~>
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '2.14'
|
140
140
|
description: Provides models, controllers and libraries that help OpenStax products
|
@@ -218,12 +218,12 @@ require_paths:
|
|
218
218
|
- lib
|
219
219
|
required_ruby_version: !ruby/object:Gem::Requirement
|
220
220
|
requirements:
|
221
|
-
- -
|
221
|
+
- - ">="
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
|
-
- -
|
226
|
+
- - ">="
|
227
227
|
- !ruby/object:Gem::Version
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|