apia 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/apia/definitions/endpoint.rb +13 -0
- data/lib/apia/dsls/endpoint.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9eccaade7623f6fc8ecae88bb8c87da23d4a436a2d76801ac6dbd2d57db9efe
|
4
|
+
data.tar.gz: c77009793790064a1f6219b6a362128359d2e98a0ccc7c8215d184f7afa36b5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc391ac5e8ad44636978220ceeb55bef47b10ba03f5826e371ed4041e428873ed59d351447d3345817e3bbb8b25bfafc6ecd01f4f86745ddc1d0851c2bc19a2
|
7
|
+
data.tar.gz: 2f92e720ce247b4408c21bc5a4096137ef75433b10c8712c4d2d115f8d4a33def15509bd5a7af05fd1bfffed9e465e57dac6cd4f5422e3aa2278e12aa0727664
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0
|
@@ -36,6 +36,19 @@ module Apia
|
|
36
36
|
@potential_errors ||= Apia::ErrorSet.new
|
37
37
|
end
|
38
38
|
|
39
|
+
def fields=(fieldset)
|
40
|
+
unless @fields.empty?
|
41
|
+
raise Apia::StandardError, 'Cannot set the fieldset on an endpoint that already has fields defined'
|
42
|
+
end
|
43
|
+
|
44
|
+
@fields = fieldset
|
45
|
+
@fields_overriden = true
|
46
|
+
end
|
47
|
+
|
48
|
+
def fields_overriden?
|
49
|
+
@fields_overriden == true
|
50
|
+
end
|
51
|
+
|
39
52
|
def dsl
|
40
53
|
@dsl ||= DSLs::Endpoint.new(self)
|
41
54
|
end
|
data/lib/apia/dsls/endpoint.rb
CHANGED
@@ -41,6 +41,10 @@ module Apia
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def field(name, *args, type: nil, **options, &block)
|
44
|
+
if @definition.fields_overriden?
|
45
|
+
raise Apia::StandardError, 'Cannot add fields to an endpoint that has a separate fieldset'
|
46
|
+
end
|
47
|
+
|
44
48
|
if pagination_options = options.delete(:paginate)
|
45
49
|
|
46
50
|
unless @definition.paginated_field.nil?
|
@@ -64,6 +68,10 @@ module Apia
|
|
64
68
|
super(name, *args, type: type, **options, &block)
|
65
69
|
end
|
66
70
|
|
71
|
+
def fields(fieldset)
|
72
|
+
@definition.fields = fieldset
|
73
|
+
end
|
74
|
+
|
67
75
|
def scopes(*names)
|
68
76
|
names.each { |name| scope(name) }
|
69
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|