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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02f0de4e3f1c59ce9d374aaf55ffcb2338ae199e
4
- data.tar.gz: fef47b3fed57917796499afd266b6f96a38d6bba
3
+ metadata.gz: 2ad5d0f09c58da345de4830a51574f9130a72563
4
+ data.tar.gz: 901d3a2e0aab5231dbdc322e7ced149ac5b01563
5
5
  SHA512:
6
- metadata.gz: aed01910118028ce08aaaddaa6286f3a1232457645da91dde93ccca3298caf5b55939bdc0d5bca2884c5da420c7231582d86b53f15100abd6777e22b244c6416
7
- data.tar.gz: 31db237994aabaeff7923741224e1ebba1d25f8676d080565fac8f6d778d7610abff86a0f05c1ea03433a8e77dd87022c873af8fb3aa82ab0a73d478caf5371a
6
+ metadata.gz: b8a14ab61b9bec85110fed882336db607aab0c8c44ed98ce63a318ed71cb9dd73d42ceaa91cc51ee655fcd3beae267d275ba39cdfca865d9011170a84a835342
7
+ data.tar.gz: c0d3122d2b48669df5d1e54ac409cbcd78f6443d792d8d5a686af7ac3d711bb821a735f23d2a9817ef1780a2596b25ac3daafc71294ea5cea4bc72ac5f02f2a0
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  inherit_from:
2
- - https://raw.githubusercontent.com/comparaonline/ruby-lint/master/rubocop.yml
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: 100
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/[USERNAME]/graphql-functions.
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
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Functions
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.3.2'.freeze
4
4
  end
5
5
  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.0
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-06-22 00:00:00.000000000 Z
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.12
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