graphiti 1.0.rc.11 → 1.0.rc.12
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 +4 -4
- data/.travis.yml +1 -5
- data/Rakefile +1 -1
- data/lib/graphiti/adapters/active_record.rb +19 -8
- data/lib/graphiti/resource/persistence.rb +5 -1
- data/lib/graphiti/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5741aeed3c5d6c85e7811c4bd5b16e1534c99995
|
4
|
+
data.tar.gz: dbaabdd369e8ce8c59b93c2ced58f749e1ae2300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452d349ea0ceda5230413c88cffd973ef6e9c2346ccc6b327644c1f176555ff8697e885a912bec5a4ba64931d35efdd1bc0590a759228341059f4708c8913b38
|
7
|
+
data.tar.gz: bcd0f0d5b95760c1b13b51c07556e26d3fc497d8f2c10aad2dada93e6b7a4488e4ece955a1ba0ad986dd8cf3ac7af95c0ce469a1f233029a4498b71af982d5ed
|
data/.travis.yml
CHANGED
@@ -5,16 +5,12 @@ rvm:
|
|
5
5
|
- 2.5
|
6
6
|
- 2.6
|
7
7
|
|
8
|
-
script: bundle exec
|
8
|
+
script: bundle exec rspec && bundle exec appraisal install && bundle exec appraisal rails-5 rspec && bundle exec appraisal rails-4 rspec
|
9
9
|
install: bundle install --retry=3 --jobs=3
|
10
10
|
|
11
11
|
before_install:
|
12
12
|
- gem install bundler -v '< 2'
|
13
13
|
|
14
|
-
gemfile:
|
15
|
-
- gemfiles/rails_4.gemfile
|
16
|
-
- gemfiles/rails_5.gemfile
|
17
|
-
|
18
14
|
deploy:
|
19
15
|
provider: rubygems
|
20
16
|
api_key:
|
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ module Graphiti
|
|
37
37
|
alias :filter_uuid_not_eq :filter_not_eq
|
38
38
|
|
39
39
|
def filter_string_eq(scope, attribute, value, is_not: false)
|
40
|
-
column = scope
|
40
|
+
column = column_for(scope, attribute)
|
41
41
|
clause = column.lower.eq_any(value.map(&:downcase))
|
42
42
|
is_not ? scope.where.not(clause) : scope.where(clause)
|
43
43
|
end
|
@@ -56,7 +56,7 @@ module Graphiti
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def filter_string_prefix(scope, attribute, value, is_not: false)
|
59
|
-
column = scope
|
59
|
+
column = column_for(scope, attribute)
|
60
60
|
map = value.map { |v| "#{v}%" }
|
61
61
|
clause = column.lower.matches_any(map)
|
62
62
|
is_not ? scope.where.not(clause) : scope.where(clause)
|
@@ -67,7 +67,7 @@ module Graphiti
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def filter_string_suffix(scope, attribute, value, is_not: false)
|
70
|
-
column = scope
|
70
|
+
column = column_for(scope, attribute)
|
71
71
|
map = value.map { |v| "%#{v}" }
|
72
72
|
clause = column.lower.matches_any(map)
|
73
73
|
is_not ? scope.where.not(clause) : scope.where(clause)
|
@@ -78,7 +78,7 @@ module Graphiti
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def filter_string_match(scope, attribute, value, is_not: false)
|
81
|
-
column = scope
|
81
|
+
column = column_for(scope, attribute)
|
82
82
|
map = value.map { |v| "%#{v.downcase}%" }
|
83
83
|
clause = column.lower.matches_any(map)
|
84
84
|
is_not ? scope.where.not(clause) : scope.where(clause)
|
@@ -89,7 +89,7 @@ module Graphiti
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def filter_gt(scope, attribute, value)
|
92
|
-
column = scope
|
92
|
+
column = column_for(scope, attribute)
|
93
93
|
scope.where(column.gt_any(value))
|
94
94
|
end
|
95
95
|
alias :filter_integer_gt :filter_gt
|
@@ -99,7 +99,7 @@ module Graphiti
|
|
99
99
|
alias :filter_date_gt :filter_gt
|
100
100
|
|
101
101
|
def filter_gte(scope, attribute, value)
|
102
|
-
column = scope
|
102
|
+
column = column_for(scope, attribute)
|
103
103
|
scope.where(column.gteq_any(value))
|
104
104
|
end
|
105
105
|
alias :filter_integer_gte :filter_gte
|
@@ -109,7 +109,7 @@ module Graphiti
|
|
109
109
|
alias :filter_date_gte :filter_gte
|
110
110
|
|
111
111
|
def filter_lt(scope, attribute, value)
|
112
|
-
column = scope
|
112
|
+
column = column_for(scope, attribute)
|
113
113
|
scope.where(column.lt_any(value))
|
114
114
|
end
|
115
115
|
alias :filter_integer_lt :filter_lt
|
@@ -119,7 +119,7 @@ module Graphiti
|
|
119
119
|
alias :filter_date_lt :filter_lt
|
120
120
|
|
121
121
|
def filter_lte(scope, attribute, value)
|
122
|
-
column = scope
|
122
|
+
column = column_for(scope, attribute)
|
123
123
|
scope.where(column.lteq_any(value))
|
124
124
|
end
|
125
125
|
alias :filter_integer_lte :filter_lte
|
@@ -272,6 +272,17 @@ module Graphiti
|
|
272
272
|
model_instance.destroy
|
273
273
|
model_instance
|
274
274
|
end
|
275
|
+
|
276
|
+
private
|
277
|
+
|
278
|
+
def column_for(scope, name)
|
279
|
+
table = scope.klass.arel_table
|
280
|
+
if other = scope.attribute_alias(name)
|
281
|
+
table[other]
|
282
|
+
else
|
283
|
+
table[name]
|
284
|
+
end
|
285
|
+
end
|
275
286
|
end
|
276
287
|
end
|
277
288
|
end
|
@@ -109,7 +109,7 @@ module Graphiti
|
|
109
109
|
def destroy(id)
|
110
110
|
model_instance = self.class._find(id: id).data
|
111
111
|
run_callbacks :destroy, :destroy, model_instance do
|
112
|
-
|
112
|
+
delete(model_instance)
|
113
113
|
end
|
114
114
|
model_instance
|
115
115
|
end
|
@@ -126,6 +126,10 @@ module Graphiti
|
|
126
126
|
adapter.save(model_instance)
|
127
127
|
end
|
128
128
|
|
129
|
+
def delete(model_instance)
|
130
|
+
adapter.destroy(model_instance)
|
131
|
+
end
|
132
|
+
|
129
133
|
private
|
130
134
|
|
131
135
|
def run_callbacks(kind, action, *args)
|
data/lib/graphiti/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.rc.
|
4
|
+
version: 1.0.rc.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|