graphql-functions 0.3.0 → 0.3.2
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/.rubocop.yml +2 -2
- data/README.md +3 -1
- data/lib/graphql/functions/array.rb +5 -0
- data/lib/graphql/functions/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad5d0f09c58da345de4830a51574f9130a72563
|
4
|
+
data.tar.gz: 901d3a2e0aab5231dbdc322e7ced149ac5b01563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8a14ab61b9bec85110fed882336db607aab0c8c44ed98ce63a318ed71cb9dd73d42ceaa91cc51ee655fcd3beae267d275ba39cdfca865d9011170a84a835342
|
7
|
+
data.tar.gz: c0d3122d2b48669df5d1e54ac409cbcd78f6443d792d8d5a686af7ac3d711bb821a735f23d2a9817ef1780a2596b25ac3daafc71294ea5cea4bc72ac5f02f2a0
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
inherit_from:
|
2
|
-
|
2
|
+
- https://raw.githubusercontent.com/comparaonline/ruby-lint/master/rubocop.yml
|
3
3
|
|
4
4
|
AllCops:
|
5
5
|
Exclude:
|
@@ -7,4 +7,4 @@ AllCops:
|
|
7
7
|
- 'bin/**/*'
|
8
8
|
|
9
9
|
Metrics/LineLength:
|
10
|
-
Max:
|
10
|
+
Max: 80
|
data/README.md
CHANGED
@@ -142,6 +142,8 @@ Array function add filters-like arguments to the query:
|
|
142
142
|
- `offset: Int` Skip the specified argument of records.
|
143
143
|
- `limit: Int` Do not return more rows than the argument.
|
144
144
|
- `ids: [Int]` Filter by the specified ids.
|
145
|
+
- `order_by: String` Order by the specified argument.
|
146
|
+
- `desc: Boolean` Flag to order descending.
|
145
147
|
|
146
148
|
|
147
149
|
## Development
|
@@ -152,7 +154,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
152
154
|
|
153
155
|
## Contributing
|
154
156
|
|
155
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
157
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/comparaonline/graphql-functions.
|
156
158
|
|
157
159
|
## License
|
158
160
|
|
@@ -6,15 +6,20 @@ module GraphQL
|
|
6
6
|
argument :ids, types[types.ID]
|
7
7
|
argument :limit, types.Int
|
8
8
|
argument :offset, types.Int
|
9
|
+
argument :order_by, types.String
|
10
|
+
argument :desc, types.Boolean
|
9
11
|
|
10
12
|
def call(*attrs)
|
11
13
|
_, args, = attrs
|
12
14
|
ids_filter = { id: args[:ids] } if args[:ids]
|
15
|
+
order_by = args[:order_by].try(:to_sym)
|
16
|
+
order = args[:desc] ? { order_by => :desc } : order_by
|
13
17
|
relation = @model_class
|
14
18
|
.all
|
15
19
|
.where(ids_filter)
|
16
20
|
.offset(args[:offset])
|
17
21
|
.limit(args[:limit])
|
22
|
+
.order(order)
|
18
23
|
|
19
24
|
(query(relation, *attrs) if respond_to?(:query)) || relation
|
20
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-functions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joaquín Moreira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.6.
|
160
|
+
rubygems_version: 2.6.11
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Collection of GraphQL functions to give basic active record like support
|