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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5db442aede360ce867a790d610a1fd52ca99149fae66d7122d18061cb2ac389
4
- data.tar.gz: 30d3c64645a15f11b6e2d96326e987f31b0623e500a56c49194e80589e7303d1
3
+ metadata.gz: f9eccaade7623f6fc8ecae88bb8c87da23d4a436a2d76801ac6dbd2d57db9efe
4
+ data.tar.gz: c77009793790064a1f6219b6a362128359d2e98a0ccc7c8215d184f7afa36b5b
5
5
  SHA512:
6
- metadata.gz: 70b9295d1b016210832c30b2d233683efa045797c5113e80bd959dfa6a6888c414f3a60e01ded946f63d50d51cd79cdae58514c2d8b483bfec29be71a89b83bd
7
- data.tar.gz: af2fa9e9322ed357a2074336a2e536d8ebb3c955692bd1b6a85812fe788fc4d5f19b0b1ecc57ce99c82b118fb7b5024a276d54edbb3560ab594b718c80e88ccd
6
+ metadata.gz: 3dc391ac5e8ad44636978220ceeb55bef47b10ba03f5826e371ed4041e428873ed59d351447d3345817e3bbb8b25bfafc6ecd01f4f86745ddc1d0851c2bc19a2
7
+ data.tar.gz: 2f92e720ce247b4408c21bc5a4096137ef75433b10c8712c4d2d115f8d4a33def15509bd5a7af05fd1bfffed9e465e57dac6cd4f5422e3aa2278e12aa0727664
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0
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
@@ -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.1.0
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-05-20 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json