active_graphql 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.hound.yml +4 -0
- data/.rspec +3 -0
- data/.rubocop.yml +48 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +25 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +134 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +6 -0
- data/active_graphql.gemspec +49 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/.nojekyll +0 -0
- data/docs/README.md +95 -0
- data/docs/_sidebar.md +4 -0
- data/docs/client.md +69 -0
- data/docs/index.html +70 -0
- data/docs/model.md +464 -0
- data/lib/active_graphql.rb +10 -0
- data/lib/active_graphql/client.rb +38 -0
- data/lib/active_graphql/client/actions.rb +15 -0
- data/lib/active_graphql/client/actions/action.rb +116 -0
- data/lib/active_graphql/client/actions/action/format_inputs.rb +80 -0
- data/lib/active_graphql/client/actions/action/format_outputs.rb +40 -0
- data/lib/active_graphql/client/actions/mutation_action.rb +29 -0
- data/lib/active_graphql/client/actions/query_action.rb +23 -0
- data/lib/active_graphql/client/adapters.rb +10 -0
- data/lib/active_graphql/client/adapters/graphlient_adapter.rb +32 -0
- data/lib/active_graphql/client/response.rb +47 -0
- data/lib/active_graphql/errors.rb +11 -0
- data/lib/active_graphql/model.rb +174 -0
- data/lib/active_graphql/model/action_formatter.rb +96 -0
- data/lib/active_graphql/model/build_or_relation.rb +66 -0
- data/lib/active_graphql/model/configuration.rb +83 -0
- data/lib/active_graphql/model/find_in_batches.rb +54 -0
- data/lib/active_graphql/model/relation_proxy.rb +321 -0
- data/lib/active_graphql/version.rb +5 -0
- metadata +254 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c4088e03c388b19e24ee701b8774fd305720a4c874d123291c93a7113a47442
|
4
|
+
data.tar.gz: e1e06ef5776c9f05b414d5a6872d0dbc402f5b7a610aeb570a8f3c0e0a4bbbb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '09184fa028d6acb513075bece3d718802ba32d020300e6dedab0182dede26aa611b6f5f9e8f3feba40a177e0dcfd022a46dac57bc98ed68712daf2a282d47321'
|
7
|
+
data.tar.gz: ad9025484d214dee6df2ad165bca15571012fe163286b81949ab0b830b84b02dce6d15ed6a62236d3b730cd0f2cacc1daf38e57384f7b3a1f2066969ab01dd05
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-performance
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.6
|
7
|
+
Exclude:
|
8
|
+
- bin/*
|
9
|
+
- active_graphql.gemspec
|
10
|
+
- Rakefile
|
11
|
+
|
12
|
+
Lint/AmbiguousBlockAssociation:
|
13
|
+
Exclude:
|
14
|
+
- spec/**/*.rb
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Exclude:
|
18
|
+
- spec/**/*.rb
|
19
|
+
|
20
|
+
Metrics/ClassLength:
|
21
|
+
Exclude:
|
22
|
+
- spec/**/*_spec.rb
|
23
|
+
|
24
|
+
Metrics/LineLength:
|
25
|
+
Enabled: true
|
26
|
+
Max: 120
|
27
|
+
|
28
|
+
|
29
|
+
Metrics/ModuleLength:
|
30
|
+
Exclude:
|
31
|
+
- spec/**/*_spec.rb
|
32
|
+
|
33
|
+
Naming/UncommunicativeMethodParamName:
|
34
|
+
AllowedNames:
|
35
|
+
- 'to'
|
36
|
+
- 'at'
|
37
|
+
- 'on'
|
38
|
+
- 'id'
|
39
|
+
- 'in'
|
40
|
+
- 'as'
|
41
|
+
|
42
|
+
RSpec/NestedGroups:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/ClassAndModuleChildren:
|
46
|
+
Exclude:
|
47
|
+
- spec/**/*_spec.rb
|
48
|
+
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.2
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
* Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
|
11
|
+
* Added: relation.empty?, relation.blank?, relation.present? methods
|
12
|
+
* Added: fields now can be marked as "keywords"
|
13
|
+
* Added: it's possible to set order for relation
|
14
|
+
* Added: it's possible to query using "or" method
|
15
|
+
* Added: it's possible merge multiple queries
|
16
|
+
* Added: class methods can be used as a scope (like in ActiveRecord)
|
17
|
+
* Added: it's possible to order by multiple atttributes
|
18
|
+
|
19
|
+
## [0.1.0] - 2019-04-25
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
* Initial code [@povilasjurcys](https://github.com/povilasjurcys).
|
24
|
+
* Documentation files [@povilasjurcys](https://github.com/povilasjurcys).
|
25
|
+
* Repo configuration files [@povilasjurcys](https://github.com/povilasjurcys).
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at povilas@samesystem.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in active_graphql.gemspec
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'activerecord'
|
9
|
+
gem 'codecov', require: false
|
10
|
+
gem 'graphql_rails', '>= 0.5.2'
|
11
|
+
gem 'pry-byebug'
|
12
|
+
gem 'simplecov', require: false
|
13
|
+
end
|
14
|
+
|
15
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
active_graphql (0.2.1)
|
5
|
+
activemodel (>= 3.0.0)
|
6
|
+
activesupport (>= 4.0.0)
|
7
|
+
graphlient (~> 0.3)
|
8
|
+
graphql (~> 1.9.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (6.0.2.1)
|
14
|
+
activesupport (= 6.0.2.1)
|
15
|
+
activerecord (6.0.2.1)
|
16
|
+
activemodel (= 6.0.2.1)
|
17
|
+
activesupport (= 6.0.2.1)
|
18
|
+
activesupport (6.0.2.1)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (>= 0.7, < 2)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
tzinfo (~> 1.1)
|
23
|
+
zeitwerk (~> 2.2)
|
24
|
+
addressable (2.7.0)
|
25
|
+
public_suffix (>= 2.0.2, < 5.0)
|
26
|
+
ast (2.4.0)
|
27
|
+
byebug (11.1.1)
|
28
|
+
codecov (0.1.16)
|
29
|
+
json
|
30
|
+
simplecov
|
31
|
+
url
|
32
|
+
coderay (1.1.2)
|
33
|
+
concurrent-ruby (1.1.6)
|
34
|
+
crack (0.4.3)
|
35
|
+
safe_yaml (~> 1.0.0)
|
36
|
+
diff-lcs (1.3)
|
37
|
+
docile (1.3.2)
|
38
|
+
faraday (0.17.3)
|
39
|
+
multipart-post (>= 1.2, < 3)
|
40
|
+
faraday_middleware (0.14.0)
|
41
|
+
faraday (>= 0.7.4, < 1.0)
|
42
|
+
graphlient (0.3.7)
|
43
|
+
faraday
|
44
|
+
faraday_middleware
|
45
|
+
graphql-client
|
46
|
+
graphql (1.9.19)
|
47
|
+
graphql-client (0.16.0)
|
48
|
+
activesupport (>= 3.0)
|
49
|
+
graphql (~> 1.8)
|
50
|
+
graphql_rails (1.0.0)
|
51
|
+
activesupport (>= 4)
|
52
|
+
graphql (>= 1.9.12)
|
53
|
+
hashdiff (1.0.1)
|
54
|
+
i18n (1.8.2)
|
55
|
+
concurrent-ruby (~> 1.0)
|
56
|
+
jaro_winkler (1.5.4)
|
57
|
+
json (2.3.0)
|
58
|
+
method_source (0.9.2)
|
59
|
+
minitest (5.14.0)
|
60
|
+
multipart-post (2.1.1)
|
61
|
+
parallel (1.19.1)
|
62
|
+
parser (2.7.0.3)
|
63
|
+
ast (~> 2.4.0)
|
64
|
+
pry (0.12.2)
|
65
|
+
coderay (~> 1.1.0)
|
66
|
+
method_source (~> 0.9.0)
|
67
|
+
pry-byebug (3.8.0)
|
68
|
+
byebug (~> 11.0)
|
69
|
+
pry (~> 0.10)
|
70
|
+
public_suffix (4.0.3)
|
71
|
+
rainbow (3.0.0)
|
72
|
+
rake (10.5.0)
|
73
|
+
rspec (3.9.0)
|
74
|
+
rspec-core (~> 3.9.0)
|
75
|
+
rspec-expectations (~> 3.9.0)
|
76
|
+
rspec-mocks (~> 3.9.0)
|
77
|
+
rspec-core (3.9.1)
|
78
|
+
rspec-support (~> 3.9.1)
|
79
|
+
rspec-expectations (3.9.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.9.0)
|
82
|
+
rspec-mocks (3.9.1)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.9.0)
|
85
|
+
rspec-support (3.9.2)
|
86
|
+
rubocop (0.75.0)
|
87
|
+
jaro_winkler (~> 1.5.1)
|
88
|
+
parallel (~> 1.10)
|
89
|
+
parser (>= 2.6)
|
90
|
+
rainbow (>= 2.2.2, < 4.0)
|
91
|
+
ruby-progressbar (~> 1.7)
|
92
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
93
|
+
rubocop-performance (1.5.2)
|
94
|
+
rubocop (>= 0.71.0)
|
95
|
+
rubocop-rspec (1.38.1)
|
96
|
+
rubocop (>= 0.68.1)
|
97
|
+
ruby-progressbar (1.10.1)
|
98
|
+
safe_yaml (1.0.5)
|
99
|
+
simplecov (0.18.5)
|
100
|
+
docile (~> 1.1)
|
101
|
+
simplecov-html (~> 0.11)
|
102
|
+
simplecov-html (0.12.2)
|
103
|
+
thread_safe (0.3.6)
|
104
|
+
tzinfo (1.2.6)
|
105
|
+
thread_safe (~> 0.1)
|
106
|
+
unicode-display_width (1.6.1)
|
107
|
+
url (0.3.2)
|
108
|
+
webmock (3.8.2)
|
109
|
+
addressable (>= 2.3.6)
|
110
|
+
crack (>= 0.3.2)
|
111
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
112
|
+
zeitwerk (2.2.2)
|
113
|
+
|
114
|
+
PLATFORMS
|
115
|
+
ruby
|
116
|
+
|
117
|
+
DEPENDENCIES
|
118
|
+
active_graphql!
|
119
|
+
activerecord
|
120
|
+
bundler (~> 2.0)
|
121
|
+
codecov
|
122
|
+
graphql_rails (>= 0.5.2)
|
123
|
+
pry
|
124
|
+
pry-byebug
|
125
|
+
rake (~> 10.0)
|
126
|
+
rspec (~> 3.0)
|
127
|
+
rubocop (= 0.75)
|
128
|
+
rubocop-performance
|
129
|
+
rubocop-rspec
|
130
|
+
simplecov
|
131
|
+
webmock (~> 3)
|
132
|
+
|
133
|
+
BUNDLED WITH
|
134
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Povilas Jurcys
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "active_graphql/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "active_graphql"
|
8
|
+
spec.version = ActiveGraphql::VERSION
|
9
|
+
spec.authors = ["Povilas Jurcys"]
|
10
|
+
spec.email = ["po.jurcys@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Graphql client}
|
13
|
+
spec.homepage = "https://github.com/samesystem/active_graphql"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/samesystem/active_graphql"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/samesystem/active_graphql/blob/v#{ActiveGraphql::VERSION}/CHANGELOG.md"
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
"public gem pushes."
|
25
|
+
end
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_dependency 'graphql', '~> 1.9.0'
|
37
|
+
spec.add_dependency 'graphlient', '~> 0.3'
|
38
|
+
spec.add_dependency 'activesupport', '>= 4.0.0'
|
39
|
+
spec.add_dependency 'activemodel', '>= 3.0.0'
|
40
|
+
|
41
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
42
|
+
spec.add_development_dependency "webmock", "~> 3"
|
43
|
+
spec.add_development_dependency "pry"
|
44
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
45
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
46
|
+
spec.add_development_dependency "rubocop", "0.75"
|
47
|
+
spec.add_development_dependency "rubocop-performance"
|
48
|
+
spec.add_development_dependency "rubocop-rspec"
|
49
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "active_graphql"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|