caprese 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f6bb6d888cb01f7e8c2b6748c62a18895f01a19
4
- data.tar.gz: b7b42665cdd23a7e9d1ecd132c7029cf93367eee
3
+ metadata.gz: 05dd3d4c79707362e7397e3a0e0a807195fb96a1
4
+ data.tar.gz: 9b797be68cb0337411807aa09c5a6bd574e8ba96
5
5
  SHA512:
6
- metadata.gz: 83d0385d1aff4dc88d6cc84e48344dffa6ec92867d56c2c0efa23c25d5f70641b7519920bbc6357455efe05bdf30f82e0dcf222461f375a123d347f10ac1f29d
7
- data.tar.gz: d639fac713750c675f6c68ad39e7d94301023bc08452f281f49161376b547832ada9e489cd7c165f09e14ebed1914ecc848973f74d87cb34e62cab1f58033589
6
+ metadata.gz: 74bf9aabe319774126d19c096691dd940e7c5a3b99e7755f76e5fdc6e648c19aa3da7955e725b3e430560a228f2b3167819280667c34ba31ffe30433424ee98e
7
+ data.tar.gz: 6378e5cbd39709e756ae7f29a1cea7bd59ffb489c84b3ceab4726264a0cb6801e9df5ba0165cfeec88bfe5adb757aa8595eaa50b2f41cf76d362a3b41d111fc7
data/CHANGELOG.md CHANGED
@@ -71,3 +71,7 @@
71
71
  ## 0.3.13
72
72
 
73
73
  * Fix bug where `queried_record` uses primary key other than `:id`
74
+
75
+ ## 0.3.14
76
+
77
+ * Add `caprese_is_attribute?` attribute aliasing helper
@@ -98,7 +98,7 @@ module Caprese
98
98
  {
99
99
  pointer: JsonApi::JsonPointer.new(:primary_data, record, attribute_name)
100
100
  }
101
- elsif record.has_attribute?(attribute_name)
101
+ elsif record.has_attribute?(attribute_name) || record.caprese_is_attribute?(attribute_name)
102
102
  {
103
103
  pointer: JsonApi::JsonPointer.new(:attribute, record, attribute_name)
104
104
  }
@@ -0,0 +1,12 @@
1
+ module Caprese
2
+ module Record
3
+ module AttributeAliasing
4
+ # Provides an intermediary helper method on records that defines non-column attributes for records
5
+ # @note This exists so there is a method by which to state that a non-column attribute should
6
+ # have an error source pointer like `/data/attributes/[name]` instead of `/data/relationships/[name]`
7
+ def caprese_is_attribute?(attribute_name)
8
+ false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -3,11 +3,13 @@ require 'active_support/concern'
3
3
  require 'active_support/dependencies'
4
4
  require 'caprese/errors'
5
5
  require 'caprese/record/associated_validator'
6
+ require 'caprese/record/attribute_aliasing'
6
7
  require 'caprese/record/errors'
7
8
 
8
9
  module Caprese
9
10
  module Record
10
11
  extend ActiveSupport::Concern
12
+ include AttributeAliasing
11
13
 
12
14
  mattr_accessor :caprese_style_errors
13
15
  @@caprese_style_errors = true
@@ -1,3 +1,3 @@
1
1
  module Caprese
2
- VERSION = '0.3.13'
2
+ VERSION = '0.3.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caprese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Landgrebe
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-02-24 00:00:00.000000000 Z
13
+ date: 2017-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_model_serializers
@@ -235,6 +235,7 @@ files:
235
235
  - lib/caprese/errors.rb
236
236
  - lib/caprese/record.rb
237
237
  - lib/caprese/record/associated_validator.rb
238
+ - lib/caprese/record/attribute_aliasing.rb
238
239
  - lib/caprese/record/errors.rb
239
240
  - lib/caprese/routing/caprese_resources.rb
240
241
  - lib/caprese/serializer.rb