graphlient 0.7.0 → 0.9.0
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 +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
- data/.github/workflows/ci.yml +33 -29
- data/.github/workflows/danger-comment.yml +10 -0
- data/.github/workflows/danger.yml +13 -22
- data/.github/workflows/rubocop.yml +19 -19
- data/.gitignore +59 -52
- data/.rspec +1 -1
- data/.rubocop.yml +26 -28
- data/.rubocop_todo.yml +72 -48
- data/CHANGELOG.md +128 -107
- data/CONTRIBUTING.md +125 -125
- data/Dangerfile +24 -24
- data/Gemfile +35 -27
- data/LICENSE +21 -21
- data/README.md +800 -508
- data/RELEASING.md +63 -63
- data/Rakefile +15 -15
- data/UPGRADING.md +23 -23
- data/graphlient.gemspec +19 -19
- data/lib/graphlient/adapters/http/adapter.rb +41 -41
- data/lib/graphlient/adapters/http/faraday_adapter.rb +79 -45
- data/lib/graphlient/adapters/http/http_adapter.rb +40 -39
- data/lib/graphlient/adapters/http.rb +3 -3
- data/lib/graphlient/adapters.rb +1 -1
- data/lib/graphlient/client.rb +98 -73
- data/lib/graphlient/errors/client_error.rb +6 -6
- data/lib/graphlient/errors/connection_failed_error.rb +6 -6
- data/lib/graphlient/errors/error.rb +13 -12
- data/lib/graphlient/errors/execution_error.rb +29 -29
- data/lib/graphlient/errors/faraday_server_error.rb +12 -12
- data/lib/graphlient/errors/graphql_error.rb +53 -52
- data/lib/graphlient/errors/http_options_error.rb +6 -6
- data/lib/graphlient/errors/http_server_error.rb +13 -13
- data/lib/graphlient/errors/server_error.rb +7 -7
- data/lib/graphlient/errors/timeout_error.rb +6 -6
- data/lib/graphlient/errors.rb +10 -10
- data/lib/graphlient/extensions/query.rb +15 -15
- data/lib/graphlient/extensions.rb +1 -1
- data/lib/graphlient/query/directive.rb +47 -0
- data/lib/graphlient/query/serializer/arguments.rb +67 -0
- data/lib/graphlient/query/serializer/directives.rb +17 -0
- data/lib/graphlient/query/serializer/evaluator.rb +15 -0
- data/lib/graphlient/query/serializer/fragments.rb +28 -0
- data/lib/graphlient/query/serializer/scalars.rb +63 -0
- data/lib/graphlient/query/serializer.rb +153 -0
- data/lib/graphlient/query.rb +29 -128
- data/lib/graphlient/schema.rb +27 -26
- data/lib/graphlient/version.rb +3 -3
- data/lib/graphlient.rb +8 -8
- data/spec/graphlient/adapters/http/faraday_adapter_spec.rb +172 -112
- data/spec/graphlient/adapters/http/http_adapter_spec.rb +60 -60
- data/spec/graphlient/client_dsl_spec.rb +153 -0
- data/spec/graphlient/client_query_spec.rb +369 -346
- data/spec/graphlient/client_schema_spec.rb +75 -55
- data/spec/graphlient/extensions/query_spec.rb +16 -16
- data/spec/graphlient/github_query_spec.rb +32 -32
- data/spec/graphlient/query_dsl_spec.rb +231 -0
- data/spec/graphlient/query_spec.rb +105 -105
- data/spec/graphlient/schema_spec.rb +56 -56
- data/spec/graphlient/static_client_query_spec.rb +75 -68
- data/spec/graphlient/webmock_client_query_spec.rb +41 -41
- data/spec/spec_helper.rb +26 -14
- data/spec/support/context/dummy_client.rb +33 -26
- data/spec/support/context/github_client.rb +18 -18
- data/spec/support/dummy_app.rb +21 -19
- data/spec/support/dummy_schema.rb +17 -17
- data/spec/support/fixtures/github/schema.yml +14282 -14282
- data/spec/support/fixtures/github/user.yml +76 -76
- data/spec/support/fixtures/github/viewer.yml +76 -76
- data/spec/support/fixtures/invoice_api.json +1288 -1288
- data/spec/support/mutations/create_invoice.rb +18 -18
- data/spec/support/queries/query.rb +48 -47
- data/spec/support/schema/github.json +44479 -44479
- data/spec/support/types/invoice_type.rb +13 -13
- data/spec/support/types/mutation_type.rb +5 -5
- data/spec/support/vcr.rb +9 -9
- metadata +13 -8
- data/Gemfile.danger +0 -5
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
require_relative '../types/invoice_type'
|
|
2
|
-
class CreateInvoice < GraphQL::Schema::RelayClassicMutation
|
|
3
|
-
null true
|
|
4
|
-
|
|
5
|
-
argument :fee_in_cents, Integer, required: true
|
|
6
|
-
|
|
7
|
-
field :invoice, InvoiceType, null: true
|
|
8
|
-
field :errors, [String], null: true
|
|
9
|
-
|
|
10
|
-
def resolve(fee_in_cents:)
|
|
11
|
-
{
|
|
12
|
-
invoice: OpenStruct.new(
|
|
13
|
-
id: 1231,
|
|
14
|
-
fee_in_cents: fee_in_cents
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
end
|
|
18
|
-
end
|
|
1
|
+
require_relative '../types/invoice_type'
|
|
2
|
+
class CreateInvoice < GraphQL::Schema::RelayClassicMutation
|
|
3
|
+
null true
|
|
4
|
+
|
|
5
|
+
argument :fee_in_cents, Integer, required: true
|
|
6
|
+
|
|
7
|
+
field :invoice, InvoiceType, null: true
|
|
8
|
+
field :errors, [String], null: true
|
|
9
|
+
|
|
10
|
+
def resolve(fee_in_cents:)
|
|
11
|
+
{
|
|
12
|
+
invoice: OpenStruct.new(
|
|
13
|
+
id: 1231,
|
|
14
|
+
fee_in_cents: fee_in_cents
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
require_relative '../types/invoice_type'
|
|
2
|
-
class Query < GraphQL::Schema::Object
|
|
3
|
-
field :invoice, InvoiceType, null: true do
|
|
4
|
-
description 'Find invoice'
|
|
5
|
-
argument :id, Integer, required: false
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
field :not_null_invoice, InvoiceType, null: false do
|
|
9
|
-
description 'Find invoice'
|
|
10
|
-
argument :id, Integer, required: false
|
|
11
|
-
end
|
|
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
|
-
|
|
22
|
-
def invoice(id: nil)
|
|
23
|
-
return nil if id.nil?
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
OpenStruct.new(id:
|
|
44
|
-
OpenStruct.new(id:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
1
|
+
require_relative '../types/invoice_type'
|
|
2
|
+
class Query < GraphQL::Schema::Object
|
|
3
|
+
field :invoice, InvoiceType, null: true do
|
|
4
|
+
description 'Find invoice'
|
|
5
|
+
argument :id, Integer, required: false
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
field :not_null_invoice, InvoiceType, null: false do
|
|
9
|
+
description 'Find invoice'
|
|
10
|
+
argument :id, Integer, required: false
|
|
11
|
+
end
|
|
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
|
+
|
|
22
|
+
def invoice(id: nil)
|
|
23
|
+
return nil if id.nil?
|
|
24
|
+
|
|
25
|
+
OpenStruct.new(
|
|
26
|
+
id: id,
|
|
27
|
+
fee_in_cents: 20_000
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def not_null_invoice(*)
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def execution_error_invoice(execution_errors:, id: nil)
|
|
36
|
+
execution_errors.add(GraphQL::ExecutionError.new('Execution Error'))
|
|
37
|
+
|
|
38
|
+
invoice(id: id)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def some_invoices
|
|
42
|
+
[
|
|
43
|
+
OpenStruct.new(id: 0, fee_in_cents: 20_000),
|
|
44
|
+
OpenStruct.new(id: 1, fee_in_cents: 20_000),
|
|
45
|
+
OpenStruct.new(id: 2, fee_in_cents: 20_000)
|
|
46
|
+
]
|
|
47
|
+
end
|
|
48
|
+
end
|