graphql-functions 0.1.0 → 0.1.1

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: d540a69a12fee13eb1031809c05c9597dbb30dd1
4
- data.tar.gz: 2471e588c8fb973ee297ce8edbaa3eb68e559580
3
+ metadata.gz: 8a1dfb32a037ebb7d11b446b57e3b6229ec8f9bf
4
+ data.tar.gz: f83784441b42922be39979cd99740a22a19985c8
5
5
  SHA512:
6
- metadata.gz: bb57a24ba4df58d1d5ef4f59779222758c77953a6ab78957b7aaf73a52af3862ccfa22c2d63505cb95b6691b9691d16f745d19bbfb5b237f7f92df7874829654
7
- data.tar.gz: 812abcd4ad410039265a56ceeab95fc11400d3d180098ec41f3a270bcdb10c5f789d64e132e9053adf7c372ffa9d284122e43e21cdf0ab0c2f81301d628db0e0
6
+ metadata.gz: 9da1a49d576d6067296f1556fba9518186f8e492d5cf11e3381a1658221b59b547cd49fa97fa31df9fbeadbc66101e07741eadda5af364d62b5e081da5fb9ef3
7
+ data.tar.gz: 399783cf2ba88d93191831bac9446fa5c6b3eb102e11940d4b963e7e8639ee53aef7d0c5bd92f5f545f8a8413a0070d823cec0f9772cca3490cbc1aa2f24515d
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # graphql-functions
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/graphql-functions.svg)](https://badge.fury.io/rb/graphql-functions)
4
+ [![CircleCI](https://circleci.com/gh/comparaonline/graphql-ruby-functions.svg?style=svg)](https://circleci.com/gh/comparaonline/graphql-ruby-functions)
5
+
3
6
  Ruby gem made to simplify the standard query creation of the [graphql](http://graphql-ruby.org) gem in your `Active Record` models with predefined **functions**.
4
7
 
5
8
  Using the provided functions your graphql **types** will gain standard and generic **query arguments** to limit the amount of rows, use an offset, or filter by an specific id among others; supporting queries like the following:
@@ -76,21 +79,7 @@ app\
76
79
 
77
80
  To help getting started is useful to use the `graphql` [generator](http://graphql-ruby.org/schema/generators#graphqlinstall).
78
81
 
79
- Then you should use one of the two provided functions to the `query type` definition:
80
-
81
- ```ruby
82
- # app/graphql/types/query_type.rb
83
- module Types
84
- QueryType = GraphQL::ObjectType.define do
85
- name "Query"
86
-
87
- field :person, function: GraphQL::Functions::Element
88
- field :people, function: GraphQL::Functions::Array
89
- end
90
- end
91
- ```
92
-
93
- If more specific logic is needed you may create a custom class with an inheritance from `GraphQL::Functions::Element` or `GraphQL::Functions::Array` like:
82
+ Then you should create a class inside the functions folder subclassing of the two provided functions to the `query type` definition:
94
83
 
95
84
  ```ruby
96
85
  # app/graphql/functions/people.rb
@@ -108,23 +97,33 @@ module Functions
108
97
  end
109
98
  ```
110
99
 
100
+ ```ruby
101
+ # app/graphql/functions/person.rb
102
+
103
+ module Functions
104
+ class Person < GraphQL::Functions::Element
105
+ model ::Person
106
+ end
107
+ end
108
+ ```
109
+
111
110
  ```ruby
112
111
  # app/graphql/types/query_type.rb
113
112
  module Types
114
113
  QueryType = GraphQL::ObjectType.define do
115
114
  name "Query"
116
115
 
117
- field :person, function: GraphQL::Functions::Element
116
+ field :person, function: Functions::Person
118
117
  field :people, function: Functions::People
119
118
  end
120
119
  end
121
120
  ```
122
121
 
123
- Above changes will in addition to the base query capabilities from `graphql-functions` allow the query to filter by countryCode like:
122
+ Above changes will in addition to the base query capabilities from `graphql-functions` allow the query to filter by `countryCode` in the `people` field like:
124
123
 
125
124
  ```
126
125
  {
127
- query(countryCode: 'us', limit: 2, offset: 5) {
126
+ people(countryCode: 'us', limit: 2, offset: 5) {
128
127
  id,
129
128
  first_name,
130
129
  last_name
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Functions
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.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.1.0
4
+ version: 0.1.1
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-09 00:00:00.000000000 Z
12
+ date: 2017-06-12 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