graphlient 0.3.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +29 -0
- data/.github/workflows/danger.yml +20 -0
- data/.github/workflows/rubocop.yml +19 -0
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +36 -18
- data/Gemfile +1 -1
- data/README.md +57 -4
- data/UPGRADING.md +11 -0
- data/graphlient.gemspec +1 -1
- data/lib/graphlient/adapters/http/adapter.rb +18 -0
- data/lib/graphlient/adapters/http/faraday_adapter.rb +8 -1
- data/lib/graphlient/adapters/http/http_adapter.rb +2 -0
- data/lib/graphlient/client.rb +5 -3
- data/lib/graphlient/errors/http_options_error.rb +6 -0
- data/lib/graphlient/errors/timeout_error.rb +6 -0
- data/lib/graphlient/errors.rb +2 -0
- data/lib/graphlient/version.rb +1 -1
- data/spec/graphlient/adapters/http/faraday_adapter_spec.rb +36 -5
- data/spec/graphlient/adapters/http/http_adapter_spec.rb +21 -2
- data/spec/graphlient/client_query_spec.rb +36 -6
- data/spec/graphlient/client_schema_spec.rb +1 -1
- data/spec/graphlient/static_client_query_spec.rb +1 -1
- data/spec/graphlient/webmock_client_query_spec.rb +40 -0
- data/spec/support/context/dummy_client.rb +1 -1
- data/spec/support/fixtures/invoice_api.json +1289 -0
- data/spec/support/mutations/create_invoice.rb +1 -0
- data/spec/support/queries/query.rb +23 -0
- data/spec/support/types/invoice_type.rb +6 -0
- metadata +16 -11
- data/.ruby-version +0 -1
- data/.travis.yml +0 -24
@@ -10,6 +10,15 @@ class Query < GraphQL::Schema::Object
|
|
10
10
|
argument :id, Integer, required: false
|
11
11
|
end
|
12
12
|
|
13
|
+
field :execution_error_invoice, InvoiceType, null: false, extras: [:execution_errors] do
|
14
|
+
description 'Find invoice'
|
15
|
+
argument :id, Integer, required: false
|
16
|
+
end
|
17
|
+
|
18
|
+
field :some_invoices, [InvoiceType], null: true do
|
19
|
+
description 'List of invoices'
|
20
|
+
end
|
21
|
+
|
13
22
|
def invoice(id: nil)
|
14
23
|
return nil if id.nil?
|
15
24
|
OpenStruct.new(
|
@@ -21,4 +30,18 @@ class Query < GraphQL::Schema::Object
|
|
21
30
|
def not_null_invoice(*)
|
22
31
|
nil
|
23
32
|
end
|
33
|
+
|
34
|
+
def execution_error_invoice(id: nil, execution_errors:)
|
35
|
+
execution_errors.add(GraphQL::ExecutionError.new('Execution Error'))
|
36
|
+
|
37
|
+
invoice(id: id)
|
38
|
+
end
|
39
|
+
|
40
|
+
def some_invoices
|
41
|
+
[
|
42
|
+
OpenStruct.new(id: 0, fee_in_cents: 20_000),
|
43
|
+
OpenStruct.new(id: 1, fee_in_cents: 20_000),
|
44
|
+
OpenStruct.new(id: 2, fee_in_cents: 20_000)
|
45
|
+
]
|
46
|
+
end
|
24
47
|
end
|
@@ -4,4 +4,10 @@ class InvoiceType < GraphQL::Schema::Object
|
|
4
4
|
|
5
5
|
field :id, ID, null: false
|
6
6
|
field :fee_in_cents, Integer, null: true
|
7
|
+
field :created_at, String, null: true, extras: [:execution_errors]
|
8
|
+
|
9
|
+
def created_at(execution_errors:)
|
10
|
+
execution_errors.add(GraphQL::ExecutionError.new('This is a partial error'))
|
11
|
+
Time.now.iso8601
|
12
|
+
end
|
7
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphlient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashkan Nasseri
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,18 +52,19 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email: ashkan.nasseri@gmail.com
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
|
+
- ".github/workflows/ci.yml"
|
62
|
+
- ".github/workflows/danger.yml"
|
63
|
+
- ".github/workflows/rubocop.yml"
|
61
64
|
- ".gitignore"
|
62
65
|
- ".rspec"
|
63
66
|
- ".rubocop.yml"
|
64
67
|
- ".rubocop_todo.yml"
|
65
|
-
- ".ruby-version"
|
66
|
-
- ".travis.yml"
|
67
68
|
- CHANGELOG.md
|
68
69
|
- CONTRIBUTING.md
|
69
70
|
- Dangerfile
|
@@ -88,8 +89,10 @@ files:
|
|
88
89
|
- lib/graphlient/errors/execution_error.rb
|
89
90
|
- lib/graphlient/errors/faraday_server_error.rb
|
90
91
|
- lib/graphlient/errors/graphql_error.rb
|
92
|
+
- lib/graphlient/errors/http_options_error.rb
|
91
93
|
- lib/graphlient/errors/http_server_error.rb
|
92
94
|
- lib/graphlient/errors/server_error.rb
|
95
|
+
- lib/graphlient/errors/timeout_error.rb
|
93
96
|
- lib/graphlient/extensions.rb
|
94
97
|
- lib/graphlient/extensions/query.rb
|
95
98
|
- lib/graphlient/query.rb
|
@@ -104,6 +107,7 @@ files:
|
|
104
107
|
- spec/graphlient/query_spec.rb
|
105
108
|
- spec/graphlient/schema_spec.rb
|
106
109
|
- spec/graphlient/static_client_query_spec.rb
|
110
|
+
- spec/graphlient/webmock_client_query_spec.rb
|
107
111
|
- spec/spec_helper.rb
|
108
112
|
- spec/support/context/dummy_client.rb
|
109
113
|
- spec/support/context/github_client.rb
|
@@ -112,6 +116,7 @@ files:
|
|
112
116
|
- spec/support/fixtures/github/schema.yml
|
113
117
|
- spec/support/fixtures/github/user.yml
|
114
118
|
- spec/support/fixtures/github/viewer.yml
|
119
|
+
- spec/support/fixtures/invoice_api.json
|
115
120
|
- spec/support/mutations/create_invoice.rb
|
116
121
|
- spec/support/queries/query.rb
|
117
122
|
- spec/support/schema/github.json
|
@@ -122,7 +127,7 @@ homepage: http://github.com/ashkan18/graphlient
|
|
122
127
|
licenses:
|
123
128
|
- MIT
|
124
129
|
metadata: {}
|
125
|
-
post_install_message:
|
130
|
+
post_install_message:
|
126
131
|
rdoc_options: []
|
127
132
|
require_paths:
|
128
133
|
- lib
|
@@ -137,8 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
142
|
- !ruby/object:Gem::Version
|
138
143
|
version: 1.3.6
|
139
144
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
141
|
-
signing_key:
|
145
|
+
rubygems_version: 3.1.3
|
146
|
+
signing_key:
|
142
147
|
specification_version: 4
|
143
148
|
summary: A friendlier Ruby client for consuming GraphQL-based APIs.
|
144
149
|
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.3.0
|
data/.travis.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.3.6
|
7
|
-
- 2.4.3
|
8
|
-
- 2.5.0
|
9
|
-
- ruby-head
|
10
|
-
- jruby-9.1.16.0
|
11
|
-
- jruby-head
|
12
|
-
|
13
|
-
before_install:
|
14
|
-
- gem update --system
|
15
|
-
|
16
|
-
matrix:
|
17
|
-
include:
|
18
|
-
- rvm: 2.3.6
|
19
|
-
script:
|
20
|
-
- bundle exec danger
|
21
|
-
allow_failures:
|
22
|
-
- rvm: ruby-head
|
23
|
-
- rvm: jruby-9.1.16.0
|
24
|
-
- rvm: jruby-head
|