graphoid 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed46bea110ff516f832f562cf3e1877b1945c72e91111914c05fd846d8ba1aea
4
- data.tar.gz: f25f965cfa36ff4c685b208019b969f0033033bfa2e8ec6801c036e89c1fab09
3
+ metadata.gz: f378f4073367b10933692401392122f489e280eba371c5d948e6b658f4a41681
4
+ data.tar.gz: b15c2a74576a089e7ac348db36064bee3c5a453c058ee49e1b2ade70ed31d767
5
5
  SHA512:
6
- metadata.gz: 95a187feed8c8411e872d73529bce845f0b7607f051b212831850c157f25c6268305367637edffc6490f5871f953a22b3d599835163750121506f15cf4e4a454
7
- data.tar.gz: ab4e772fbb496ea0f74ed1e8e44f5f9dc54a19f4d96c300181386cd0805358ffe96ff5e920ff9251dd3476f3385ff293f3909e10b0cf0ec0b7bda2bdead4dce4
6
+ metadata.gz: 198545eb295723959addc1cb94b7f875c75efade653454385cf2664467cd7d5e2a9b0bba144be72db3d3f77412008c90566f0bcde0fa38c9b99e291a2a0c8546
7
+ data.tar.gz: c5a940b62e3edb6e43caaf0f569a85652ee73ccbcbac037a1317fab0d77ac8b21c56f897e198de69bd4e3f24e7071e3f7f490d27b9d98a1856fe52f2e314b83e
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- <img src="https://d3a1eqpdtt5fg4.cloudfront.net/items/0T0M3O2R1q2W3i1p3e0A/graphoid.png" height="200" alt="graphoid"/>
2
+ <img src="https://d3a1eqpdtt5fg4.cloudfront.net/items/0T0M3O2R1q2W3i1p3e0A/graphoid.png" height="150" alt="graphoid"/>
3
3
 
4
4
  [![Build Status](https://travis-ci.org/maxiperezc/graphoid.svg?branch=master)](https://travis-ci.org/maxiperezc/graphoid)
5
5
  [![Gem Version](https://badge.fury.io/rb/graphoid.svg)](https://rubygems.org/gems/graphoid)
@@ -8,8 +8,9 @@ This gem is used to generate a full GraphQL API using introspection of Mongoid o
8
8
  After installing it, you will have create, update, delete, and query actions on any rails models you want.
9
9
 
10
10
  ## Dependency
11
- This gem depends on the graphql gem for rails https://github.com/rmosolgo/graphql-ruby
12
- So please install that gem first before continuing
11
+ This gem depends on [the GraphQL gem](https://github.com/rmosolgo/graphql-ruby).
12
+
13
+ Please install that gem first before continuing
13
14
 
14
15
  ## Installation
15
16
  Add this line to your Gemfile:
@@ -58,6 +59,9 @@ class Person
58
59
  end
59
60
  ```
60
61
 
62
+ ## Examples
63
+ You can find an example that uses ActiveRecord in the [Tester AR folder](https://github.com/maxiperezc/graphoid/tree/master/spec/tester_ar) and an example with Mongoid in the [Tester Mongo folder](https://github.com/maxiperezc/graphoid/tree/master/spec/tester_mongo) of this same repository.
64
+
61
65
  ## Contributing
62
66
  - Install code climate
63
67
  - Functionality to sort top level models by association values
@@ -76,5 +80,11 @@ end
76
80
  - Embedded::Many filtering implementation
77
81
  - Embedded::One filtering with OR/AND
78
82
 
83
+ ## Testing
84
+ ```bash
85
+ $ DRIVER=ar DEBUG=true bundle exec rspec
86
+ $ DRIVER=mongo DEBUG=true bundle exec rspec
87
+ ```
88
+
79
89
  ## License
80
90
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,19 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Graphoid
4
- module Orders
4
+ module Sorter
5
5
  LIST = {}
6
6
  @@enum_type = nil
7
7
 
8
8
  class << self
9
9
  def generate(model)
10
10
  LIST[model] ||= GraphQL::InputObjectType.define do
11
- name("#{Utils.graphqlize(model.name)}Order")
12
- description("Generated model order for #{model.name}")
11
+ name("#{Utils.graphqlize(model.name)}Sorter")
12
+ description("Generated model Sorter for #{model.name}")
13
13
 
14
14
  Attribute.fields_of(model).each do |field|
15
15
  name = Utils.camelize(field.name)
16
- argument(name, Orders.enum_type)
16
+ argument(name, Sorter.enum_type)
17
17
  end
18
18
 
19
19
  Relation.relations_of(model).each do |name, relation|
@@ -32,7 +32,7 @@ module Graphoid
32
32
 
33
33
  def enum_type
34
34
  @@enum_type ||= GraphQL::EnumType.define do
35
- name 'OrderType'
35
+ name 'SorterType'
36
36
 
37
37
  value 'ASC', 'Ascendent'
38
38
  value 'DESC', 'Descendent'
@@ -61,7 +61,7 @@ module Graphoid
61
61
  next unless relation_type
62
62
 
63
63
  filter = Graphoid::Filters::LIST[relation_class]
64
- order = Graphoid::Orders::LIST[relation_class]
64
+ order = Graphoid::Sorter::LIST[relation_class]
65
65
 
66
66
  if Relation.new(relation).many?
67
67
  plural_name = name.pluralize
@@ -9,7 +9,7 @@ module Graphoid
9
9
  build_naming(model)
10
10
 
11
11
  @type = Graphoid::Types.generate(model)
12
- @order = Graphoid::Orders.generate(model)
12
+ @order = Graphoid::Sorter.generate(model)
13
13
  @input = Graphoid::Inputs.generate(model)
14
14
  @filter = Graphoid::Filters.generate(model)
15
15
  end
data/lib/graphoid.rb CHANGED
@@ -31,7 +31,7 @@ require 'graphoid/drivers/mongoid'
31
31
  require 'graphoid/drivers/active_record'
32
32
 
33
33
  require 'graphoid/definitions/types'
34
- require 'graphoid/definitions/orders'
34
+ require 'graphoid/definitions/sorter'
35
35
  require 'graphoid/definitions/filters'
36
36
  require 'graphoid/definitions/inputs'
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximiliano Perez Coto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-11 00:00:00.000000000 Z
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.8.17
27
- - !ruby/object:Gem::Dependency
28
- name: rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 5.1.6
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 5.1.6
41
27
  description: A gem that helps you autogenerate a GraphQL API from Mongoid or ActiveRecord
42
28
  models.
43
29
  email:
@@ -54,7 +40,7 @@ files:
54
40
  - lib/graphoid/config.rb
55
41
  - lib/graphoid/definitions/filters.rb
56
42
  - lib/graphoid/definitions/inputs.rb
57
- - lib/graphoid/definitions/orders.rb
43
+ - lib/graphoid/definitions/sorter.rb
58
44
  - lib/graphoid/definitions/types.rb
59
45
  - lib/graphoid/drivers/active_record.rb
60
46
  - lib/graphoid/drivers/mongoid.rb