rider-kick 0.0.9 → 0.0.10

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
  SHA256:
3
- metadata.gz: ec75fc6ba1f45d9d70021b69e3bdda3a01585978679adcd3ee32ab9d50b0a372
4
- data.tar.gz: 67886957fb7270e9529ac94ec311459aabaaf6a434a732751d5980a10bad65c9
3
+ metadata.gz: 690e15a100ac2e09e0e544d510371d18d86acdbe330f9853d15f4d09cbae0629
4
+ data.tar.gz: 5a022cc170be59668e87350f9f1aad51b562cf3c48ac74c163000b1f5597e4d4
5
5
  SHA512:
6
- metadata.gz: 2fc7a917595c6fa982088940eb56c7843773474a8ce91d95c87485e78943b3e8615c7353125b2fb456f113e76292202839f0737910146482d5c1eec604d4508f
7
- data.tar.gz: 944b95a7baf3d9339520025ba8529b2de11f63be7b48f8429f2fb3e5435f14628054d64c07a2330f859adbd6216dbbdcc3e46e2ede1a67e80dcd344890785a38
6
+ metadata.gz: 76d7ded3e22bcb5084daa2e642274a11c77ee83753f79c3063e46fd7a1461d4b9d90ec9dbb129fb57d72ba2b4dbaf4dd61c5772eecffca477cf187ef8ff00d0b
7
+ data.tar.gz: 73e9a0511fd0884b3ce559d6d0f3163b0f223b4b28de237f7db65b590602ac3e62cd665a5fcd1aa037fae1a10b539ad40cc62c1ce121b7d41c13e7cbcc27c3f8
@@ -118,9 +118,6 @@ module RiderKick
118
118
 
119
119
  def contract_fields
120
120
  skip_contract_fields = @skipped_fields.map(&:strip).uniq
121
- if @scope_owner_column.present?
122
- skip_contract_fields << @scope_owner_column.to_s
123
- end
124
121
  @model_class.columns.reject { |column| skip_contract_fields.include?(column.name.to_s) }.map(&:name).map(&:to_s)
125
122
  end
126
123
 
@@ -21,7 +21,6 @@ module RiderKick
21
21
  end
22
22
 
23
23
  def setup_variables
24
- @scope_owner_column = (SunSword.scope_owner_column.to_s rescue '')
25
24
  @variable_subject = arg_model_name.split('::').last.underscore.downcase
26
25
  @model_class = arg_model_name.camelize.constantize
27
26
  @subject_class = arg_model_name.split('::').last
@@ -65,7 +64,7 @@ module RiderKick
65
64
  end
66
65
 
67
66
  def contract_fields
68
- @model_class.columns.reject { |column| (['id', 'created_at', 'updated_at', 'type'] + [@scope_owner_column.to_s]).include?(column.name.to_s) }.map(&:name).map(&:to_s)
67
+ @model_class.columns.reject { |column| ['id', 'created_at', 'updated_at', 'type'].include?(column.name.to_s) }.map(&:name).map(&:to_s)
69
68
  end
70
69
 
71
70
  def get_column_type(field)
@@ -27,12 +27,12 @@ module RiderKick
27
27
  private :entity_class
28
28
  end
29
29
 
30
- def self.has_many(relation_name, use:)
31
- @has_many_builders << [relation_name, use]
30
+ def self.has_many(relation_name, attribute_as: nil, use:)
31
+ @has_many_builders << [attribute_as, relation_name, use]
32
32
  end
33
33
 
34
- def self.belongs_to(relation_name, use:)
35
- @belongs_to_builders << [relation_name, use]
34
+ def self.belongs_to(relation_name, attribute_as: nil, use:)
35
+ @belongs_to_builders << [attribute_as, relation_name, use]
36
36
  end
37
37
 
38
38
  # @param [ActiveRecord::Base] An ActiveRecord model to map to the entity
@@ -86,11 +86,11 @@ module RiderKick
86
86
 
87
87
  def attributes_for_belongs_to_relations
88
88
  self.class.belongs_to_builders.map do |belongs_to_builder_config|
89
- relation_name, builder_class = belongs_to_builder_config
90
- relation = @params.public_send(relation_name)
89
+ attribute, relation_name, builder_class = belongs_to_builder_config
90
+ relation = @params.public_send(relation_name)
91
91
 
92
92
  [
93
- relation_name,
93
+ attribute || relation_name,
94
94
  relation ? builder_class.new(relation).build : nil
95
95
  ]
96
96
  end.to_h
@@ -98,14 +98,14 @@ module RiderKick
98
98
 
99
99
  def attributes_for_has_many_relations
100
100
  self.class.has_many_builders.map do |has_many_builder_config|
101
- relation_name, builder_class = has_many_builder_config
102
- relations = @params.public_send(relation_name)
103
- built_relations = relations.map do |relation|
101
+ attribute, relation_name, builder_class = has_many_builder_config
102
+ relations = @params.public_send(relation_name)
103
+ built_relations = relations.map do |relation|
104
104
  builder_class.new(relation).build
105
105
  end
106
106
 
107
107
  [
108
- relation_name,
108
+ attribute || relation_name,
109
109
  built_relations
110
110
  ]
111
111
  end.to_h
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RiderKick
4
- VERSION = '0.0.9'
4
+ VERSION = '0.0.10'
5
5
  public_constant :VERSION
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rider-kick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kotaro Minami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-matcher