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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
  4. data/.github/workflows/ci.yml +33 -29
  5. data/.github/workflows/danger-comment.yml +10 -0
  6. data/.github/workflows/danger.yml +13 -22
  7. data/.github/workflows/rubocop.yml +19 -19
  8. data/.gitignore +59 -52
  9. data/.rspec +1 -1
  10. data/.rubocop.yml +26 -28
  11. data/.rubocop_todo.yml +72 -48
  12. data/CHANGELOG.md +128 -107
  13. data/CONTRIBUTING.md +125 -125
  14. data/Dangerfile +24 -24
  15. data/Gemfile +35 -27
  16. data/LICENSE +21 -21
  17. data/README.md +800 -508
  18. data/RELEASING.md +63 -63
  19. data/Rakefile +15 -15
  20. data/UPGRADING.md +23 -23
  21. data/graphlient.gemspec +19 -19
  22. data/lib/graphlient/adapters/http/adapter.rb +41 -41
  23. data/lib/graphlient/adapters/http/faraday_adapter.rb +79 -45
  24. data/lib/graphlient/adapters/http/http_adapter.rb +40 -39
  25. data/lib/graphlient/adapters/http.rb +3 -3
  26. data/lib/graphlient/adapters.rb +1 -1
  27. data/lib/graphlient/client.rb +98 -73
  28. data/lib/graphlient/errors/client_error.rb +6 -6
  29. data/lib/graphlient/errors/connection_failed_error.rb +6 -6
  30. data/lib/graphlient/errors/error.rb +13 -12
  31. data/lib/graphlient/errors/execution_error.rb +29 -29
  32. data/lib/graphlient/errors/faraday_server_error.rb +12 -12
  33. data/lib/graphlient/errors/graphql_error.rb +53 -52
  34. data/lib/graphlient/errors/http_options_error.rb +6 -6
  35. data/lib/graphlient/errors/http_server_error.rb +13 -13
  36. data/lib/graphlient/errors/server_error.rb +7 -7
  37. data/lib/graphlient/errors/timeout_error.rb +6 -6
  38. data/lib/graphlient/errors.rb +10 -10
  39. data/lib/graphlient/extensions/query.rb +15 -15
  40. data/lib/graphlient/extensions.rb +1 -1
  41. data/lib/graphlient/query/directive.rb +47 -0
  42. data/lib/graphlient/query/serializer/arguments.rb +67 -0
  43. data/lib/graphlient/query/serializer/directives.rb +17 -0
  44. data/lib/graphlient/query/serializer/evaluator.rb +15 -0
  45. data/lib/graphlient/query/serializer/fragments.rb +28 -0
  46. data/lib/graphlient/query/serializer/scalars.rb +63 -0
  47. data/lib/graphlient/query/serializer.rb +153 -0
  48. data/lib/graphlient/query.rb +29 -128
  49. data/lib/graphlient/schema.rb +27 -26
  50. data/lib/graphlient/version.rb +3 -3
  51. data/lib/graphlient.rb +8 -8
  52. data/spec/graphlient/adapters/http/faraday_adapter_spec.rb +172 -112
  53. data/spec/graphlient/adapters/http/http_adapter_spec.rb +60 -60
  54. data/spec/graphlient/client_dsl_spec.rb +153 -0
  55. data/spec/graphlient/client_query_spec.rb +369 -346
  56. data/spec/graphlient/client_schema_spec.rb +75 -55
  57. data/spec/graphlient/extensions/query_spec.rb +16 -16
  58. data/spec/graphlient/github_query_spec.rb +32 -32
  59. data/spec/graphlient/query_dsl_spec.rb +231 -0
  60. data/spec/graphlient/query_spec.rb +105 -105
  61. data/spec/graphlient/schema_spec.rb +56 -56
  62. data/spec/graphlient/static_client_query_spec.rb +75 -68
  63. data/spec/graphlient/webmock_client_query_spec.rb +41 -41
  64. data/spec/spec_helper.rb +26 -14
  65. data/spec/support/context/dummy_client.rb +33 -26
  66. data/spec/support/context/github_client.rb +18 -18
  67. data/spec/support/dummy_app.rb +21 -19
  68. data/spec/support/dummy_schema.rb +17 -17
  69. data/spec/support/fixtures/github/schema.yml +14282 -14282
  70. data/spec/support/fixtures/github/user.yml +76 -76
  71. data/spec/support/fixtures/github/viewer.yml +76 -76
  72. data/spec/support/fixtures/invoice_api.json +1288 -1288
  73. data/spec/support/mutations/create_invoice.rb +18 -18
  74. data/spec/support/queries/query.rb +48 -47
  75. data/spec/support/schema/github.json +44479 -44479
  76. data/spec/support/types/invoice_type.rb +13 -13
  77. data/spec/support/types/mutation_type.rb +5 -5
  78. data/spec/support/vcr.rb +9 -9
  79. metadata +13 -8
  80. data/Gemfile.danger +0 -5
data/CHANGELOG.md CHANGED
@@ -1,107 +1,128 @@
1
- ### (Next)
2
- * Your contribution here.
3
-
4
- ### 0.7.0 (2022/10/11)
5
- * [#98](https://github.com/ashkan18/graphlient/pull/98): Bring back danger checks and improve them - [@ashkan18](https://github.com/ashkan18).
6
- * [#94](https://github.com/ashkan18/graphlient/pull/94): Enabled fragments - [@rellampec](https://github.com/rellampec).
7
- * [#95](https://github.com/ashkan18/graphlient/pull/95): Upgrade faraday dependency to version 2 - [@kirillkaiumov](https://github.com/kirillkaiumov).
8
-
9
- ### 0.6.0 (2022/06/11)
10
-
11
- * [#87](https://github.com/ashkan18/graphlient/pull/87): Raised `ExecutionError` with partial error response - [@QQism](https://github.com/QQism).
12
- * [#90](https://github.com/ashkan18/graphlient/pull/90): Added support for Ruby 3.1 - [@QQism](https://github.com/QQism).
13
- * [#90](https://github.com/ashkan18/graphlient/pull/90): Dropped support for Ruby 2.5 - [@QQism](https://github.com/QQism).
14
- * [#91](https://github.com/ashkan18/graphlient/pull/91): Update GHA for `danger` with right permissions - [@QQism](https://github.com/QQism).
15
- * [#89](https://github.com/ashkan18/graphlient/pull/89): Replace Travis CI with Github Actions - [@QQism](https://github.com/QQism).
16
-
17
- ### 0.5.0 (2020/12/28)
18
-
19
- * [#81](https://github.com/ashkan18/graphlient/pull/81): Make graphlient run on ruby 3.0 - [@Burgestrand](https://github.com/Burgestrand).
20
- * [#79](https://github.com/ashkan18/graphlient/pull/79): Added client testing docs - [@GabrielDzul](https://github.com/GabrielDzul).
21
-
22
- ### 0.4.0 (2020/05/22)
23
-
24
- * [#72](https://github.com/ashkan18/graphlient/pull/72): Add http_options - [@neroleung](https://github.com/neroleung).
25
- * [#71](https://github.com/ashkan18/graphlient/issues/70): Add `Graphlient::Errors::TimeoutError` - [@BenDrozdoff](https://github.com/BenDrozdoff).
26
- * [#75](https://github.com/ashkan18/graphlient/pull/75): Support Faraday 1.x - [@jfhinchcliffe](https://github.com/jfhinchcliffe).
27
- * [#78](https://github.com/ashkan18/graphlient/pull/78): Add description of timeout values - [@sap1enza](https://github.com/sap1enza).
28
-
29
- ### 0.3.7 (2019/11/14)
30
-
31
- * [#68](https://github.com/ashkan18/graphlient/pull/68): Add `Graphlient::Errors::ConnectionFailedError` - [@neroleung](https://github.com/neroleung).
32
-
33
- ### 0.3.6 (2019/07/23)
34
-
35
- * [#63](https://github.com/ashkan18/graphlient/pull/63): Remove unused method for attribute with typo - [@ashkan18](https://github.com/ashkan18).
36
- * [#62](https://github.com/ashkan18/graphlient/pull/62): Fix typo preventing access to response object on error - [@jmondo](https://github.com/jmondo).
37
-
38
- ### 0.3.4 (2019/01/31)
39
-
40
- * [#56](https://github.com/ashkan18/graphlient/pull/56): Remove safe navigation usage to retain support for Ruby 2.2 - [@avinoth](https://github.com/avinoth).
41
- * [#57](https://github.com/ashkan18/graphlient/pull/57): Add support for parsing queries from a String - [@ateamlunchbox](https://github.com/ateamlunchbox).
42
-
43
- ### 0.3.3 (2018/09/23)
44
-
45
- * [#50](https://github.com/ashkan18/graphlient/pull/50): More detailed error responses - [@ashkan18](https://github.com/ashkan18).
46
-
47
- ### 0.3.2 (2018/07/03)
48
-
49
- * [#46](https://github.com/ashkan18/graphlient/pull/46): Fix issue with gathering error details when trying `to_s` on `GraphQLError` - [@ashkan18](https://github.com/ashkan18).
50
- * [#45](https://github.com/ashkan18/graphlient/pull/45): Drop Support for Ruby 2.2 and Lock RuboCop - [@jonallured](https://github.com/jonallured).
51
-
52
- ### 0.3.1 (2018/04/17)
53
-
54
- * [#43](https://github.com/ashkan18/graphlient/pull/43): Allow to load and dump schema to json - [@povilasjurcys](https://github.com/povilasjurcys).
55
-
56
- ### 0.3.0 (2018/02/22)
57
-
58
- * [#38](https://github.com/ashkan18/graphlient/pull/38): Add support for Ruby 2.5 - [@yuki24](https://github.com/yuki24).
59
- * [#39](https://github.com/ashkan18/graphlient/pull/39): Add support for Ruby 2.2 - [@yuki24](https://github.com/yuki24).
60
- * [#40](https://github.com/ashkan18/graphlient/pull/40): Add experimental support for JRuby - [@yuki24](https://github.com/yuki24).
61
-
62
- ### 0.2.0 (2017/11/09)
63
-
64
- * [#33](https://github.com/ashkan18/graphlient/pull/33): Added dsl for supporting parametrized queries/mutations - [@ashkan18](https://github.com/ashkan18).
65
- * [#34](https://github.com/ashkan18/graphlient/issues/34): Fix: don't convert variables to `String` - [@dblock](https://github.com/dblock).
66
-
67
- ### 0.1.0 (2017/10/27)
68
-
69
- * [#31](https://github.com/ashkan18/graphlient/issues/31): Fix: catch execution errors that don't contain field names - [@dblock](https://github.com/dblock).
70
-
71
- ### 0.0.9 (2017/10/26)
72
-
73
- * [#28](https://github.com/ashkan18/graphlient/pull/28): Raise errors in `execute`, not only `query` - [@dblock](https://github.com/dblock).
74
- * [#29](https://github.com/ashkan18/graphlient/pull/29): Added `Graphlient::Adapters::HTTP::HTTPAdapter` that replaces Faraday with `Net::HTTP` - [@dblock](https://github.com/dblock).
75
-
76
- ### 0.0.8 (2017/10/26)
77
-
78
- * [#27](https://github.com/ashkan18/graphlient/pull/27): Always raise an exception unless a query has succeeded - [@dblock](https://github.com/dblock).
79
-
80
- ### 0.0.7 (2017/10/24)
81
-
82
- * [#26](https://github.com/ashkan18/graphlient/pull/26): Support String queries - [@dblock](https://github.com/dblock).
83
-
84
- ### 0.0.6 (2017/10/20)
85
-
86
- * [#14](https://github.com/ashkan18/graphlient/pull/14): Switch to `graphql-client` for network calls and schema validation - [@ashkan18](https://github.com/ashkan18).
87
- * [#17](https://github.com/ashkan18/graphlient/pull/17): Specialize server errors as `Graphlient::Errors::Server` - [@dblock](https://github.com/dblock).
88
- * [#13](https://github.com/ashkan18/graphlient/pull/13): Support named queries and make sure, this is braking change where we no longer support queries that don't start with `query` - [@ashkan18](https://github.com/ashkan18).
89
- * [#21](https://github.com/ashkan18/graphlient/pull/21): Added danger, PR linter - [@dblock](https://github.com/dblock).
90
- * [#17](https://github.com/ashkan18/graphlient/pull/17): Enable customizing of Faraday middleware - [@dblock](https://github.com/dblock).
91
- * [#19](https://github.com/ashkan18/graphlient/pull/19): Expose `client.schema` - [@dblock](https://github.com/dblock).
92
- * [#20](https://github.com/ashkan18/graphlient/pull/20): Added support for parameterized queries and mutations - [@dblock](https://github.com/dblock).
93
- * [#25](https://github.com/ashkan18/graphlient/pull/25): Added `client.parse` and `client.execute` to parse and execute queries separately - [@dblock](https://github.com/dblock).
94
-
95
- ### 0.0.5 (2017/10/05)
96
-
97
- * [#11](https://github.com/ashkan18/graphlient/pull/11): Fixed query argument types - [@ashkan18](https://github.com/ashkan18).
98
-
99
- ### 0.0.4 (2017/10/04)
100
-
101
- * [#8](https://github.com/ashkan18/graphlient/pull/8): Handle HTTP errors and raise `Graphlient::Errors::HTTP` on failure - [@dblock](https://github.com/dblock).
102
- * [#5](https://github.com/ashkan18/graphlient/pull/5): Added RuboCop, Ruby-style linter, CHANGELOG, CONTRIBUTING and RELEASING - [@dblock](https://github.com/dblock).
103
- * [#4](https://github.com/ashkan18/graphlient/pull/4): Refactored Graphlient::Client to take a URL and options, moved extensions - [@dblock](https://github.com/dblock).
104
-
105
- ### 0.0.3 (2017/10/03)
106
-
107
- * Initial public release - [@ashkan18](https://github.com/ashkan18).
1
+ ### (Next)
2
+ * Your contribution here.
3
+
4
+ ### 0.9.0 (2026/08/03)
5
+ * [#118](https://github.com/ashkan18/graphlient/pull/118): Correct `TimeoutError` inheritance and rescue documentation - [@oiahoon](https://github.com/oiahoon).
6
+ * [#117](https://github.com/ashkan18/graphlient/pull/117): Migrate Danger to use `danger-pr-comment` reusable workflow, add Ruby 4.0 to CI, fix tests on Ruby 3.4+ and 4.0 - [@dblock](https://github.com/dblock).
7
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): Directive DSL `_skip(if: :x)` → `@skip(if: $x)`, `_include(if: :x)` → `@include(if: $x)`. Any `_name` method is treated as a `@name` directive; applies to fields, spreads, and inline fragments - [@rellampec](https://github.com/rellampec).
8
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): `spread(on: :Type, *directives, &block)`: inline fragment DSL — `spread(on: :PaidInvoice) { amountPaid }` → `... on PaidInvoice { amountPaid }`. `spread` is the single verb for both named fragment spreads (`spread :Name`) and inline fragments (`spread on: :Type`), using the same `on:` keyword as `fragment(name, on:)` - [@rellampec](https://github.com/rellampec).
9
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): `fragment(:Name, on: :Type, &block)`: inline fragment definition appended to the query document automatically; scoped to the query call, no global registry - [@rellampec](https://github.com/rellampec).
10
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): Custom scalar registration — `c.scalar :date, 'Date'` extends the built-in scalar set (`:int`, `:float`, `:string`, `:boolean`) with API-specific types - [@rellampec](https://github.com/rellampec).
11
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): `Query` refactored into `Query::Serializer` composed from concern modules (`Scalars`, `Arguments`, `Evaluator`, `Fragments`, `Directives`). Public API unchanged - [@rellampec](https://github.com/rellampec).
12
+ * [#116](https://github.com/ashkan18/graphlient/pull/116): CI: Ruby 3.4 added to test matrix; Ruby 3.1 WebMock `to_rack` fix; `mutex_m` gem added for Ruby 3.4 stdlib removal - [@rellampec](https://github.com/rellampec).
13
+ * [#115](https://github.com/ashkan18/graphlient/pull/115): `Client#to_query_string(**kargs, &block)`: builds the full GraphQL query document from the DSL block and returns a `String` without touching the schema or Faraday HTTP adapter. Enables DSL-only mode where HTTP dispatch is handled externally - [@rellampec](https://github.com/rellampec).
14
+ * [#115](https://github.com/ashkan18/graphlient/pull/115): `Query#spread(fragment_name)`: emits `...FragmentName` into the query string as a named fragment spread. Alternative to the `___Const` convention for use cases where `graphql-client` constant parsing is not available - [@rellampec](https://github.com/rellampec).
15
+ * [#115](https://github.com/ashkan18/graphlient/pull/115): `spec/spec_helper.rb`: rescue `LoadError` on `byebug` require so specs run on platforms where byebug is not installable (e.g. Windows with Ruby 3.2) - [@rellampec](https://github.com/rellampec).
16
+ * [#113](https://github.com/ashkan18/graphlient/pull/113): Fix CI builds - [@yuki24](https://github.com/yuki24).
17
+ * [#112](https://github.com/ashkan18/graphlient/pull/112): Update graphql-client github repository links in README - [@th1988](https://github.com/th1988).
18
+
19
+ ### 0.8.0 (2024/01/06)
20
+ * [#110](https://github.com/ashkan18/graphlient/pull/110): Ensure correct Faraday JSON response body parsing with invalid response header - [@taylorthurlow](https://github.com/taylorthurlow).
21
+ * [#107](https://github.com/ashkan18/graphlient/pull/107): Pass in initialized schema as an option - [@kbaum](https://github.com/kbaum).
22
+ * [#106](https://github.com/ashkan18/graphlient/pull/106): Add 3.2 to the list of ruby ci versions - [@igor-drozdov](https://github.com/igor-drozdov).
23
+ * [#102](https://github.com/ashkan18/graphlient/pull/102): Update ci to test latest jruby - [@ashkan18](https://github.com/ashkan18).
24
+
25
+ ### 0.7.0 (2022/10/11)
26
+ * [#98](https://github.com/ashkan18/graphlient/pull/98): Bring back danger checks and improve them - [@ashkan18](https://github.com/ashkan18).
27
+ * [#94](https://github.com/ashkan18/graphlient/pull/94): Enabled fragments - [@rellampec](https://github.com/rellampec).
28
+ * [#95](https://github.com/ashkan18/graphlient/pull/95): Upgrade faraday dependency to version 2 - [@kirillkaiumov](https://github.com/kirillkaiumov).
29
+
30
+ ### 0.6.0 (2022/06/11)
31
+
32
+ * [#87](https://github.com/ashkan18/graphlient/pull/87): Raised `ExecutionError` with partial error response - [@QQism](https://github.com/QQism).
33
+ * [#90](https://github.com/ashkan18/graphlient/pull/90): Added support for Ruby 3.1 - [@QQism](https://github.com/QQism).
34
+ * [#90](https://github.com/ashkan18/graphlient/pull/90): Dropped support for Ruby 2.5 - [@QQism](https://github.com/QQism).
35
+ * [#91](https://github.com/ashkan18/graphlient/pull/91): Update GHA for `danger` with right permissions - [@QQism](https://github.com/QQism).
36
+ * [#89](https://github.com/ashkan18/graphlient/pull/89): Replace Travis CI with Github Actions - [@QQism](https://github.com/QQism).
37
+
38
+ ### 0.5.0 (2020/12/28)
39
+
40
+ * [#81](https://github.com/ashkan18/graphlient/pull/81): Make graphlient run on ruby 3.0 - [@Burgestrand](https://github.com/Burgestrand).
41
+ * [#79](https://github.com/ashkan18/graphlient/pull/79): Added client testing docs - [@GabrielDzul](https://github.com/GabrielDzul).
42
+
43
+ ### 0.4.0 (2020/05/22)
44
+
45
+ * [#72](https://github.com/ashkan18/graphlient/pull/72): Add http_options - [@neroleung](https://github.com/neroleung).
46
+ * [#71](https://github.com/ashkan18/graphlient/issues/70): Add `Graphlient::Errors::TimeoutError` - [@BenDrozdoff](https://github.com/BenDrozdoff).
47
+ * [#75](https://github.com/ashkan18/graphlient/pull/75): Support Faraday 1.x - [@jfhinchcliffe](https://github.com/jfhinchcliffe).
48
+ * [#78](https://github.com/ashkan18/graphlient/pull/78): Add description of timeout values - [@sap1enza](https://github.com/sap1enza).
49
+
50
+ ### 0.3.7 (2019/11/14)
51
+
52
+ * [#68](https://github.com/ashkan18/graphlient/pull/68): Add `Graphlient::Errors::ConnectionFailedError` - [@neroleung](https://github.com/neroleung).
53
+
54
+ ### 0.3.6 (2019/07/23)
55
+
56
+ * [#63](https://github.com/ashkan18/graphlient/pull/63): Remove unused method for attribute with typo - [@ashkan18](https://github.com/ashkan18).
57
+ * [#62](https://github.com/ashkan18/graphlient/pull/62): Fix typo preventing access to response object on error - [@jmondo](https://github.com/jmondo).
58
+
59
+ ### 0.3.4 (2019/01/31)
60
+
61
+ * [#56](https://github.com/ashkan18/graphlient/pull/56): Remove safe navigation usage to retain support for Ruby 2.2 - [@avinoth](https://github.com/avinoth).
62
+ * [#57](https://github.com/ashkan18/graphlient/pull/57): Add support for parsing queries from a String - [@ateamlunchbox](https://github.com/ateamlunchbox).
63
+
64
+ ### 0.3.3 (2018/09/23)
65
+
66
+ * [#50](https://github.com/ashkan18/graphlient/pull/50): More detailed error responses - [@ashkan18](https://github.com/ashkan18).
67
+
68
+ ### 0.3.2 (2018/07/03)
69
+
70
+ * [#46](https://github.com/ashkan18/graphlient/pull/46): Fix issue with gathering error details when trying `to_s` on `GraphQLError` - [@ashkan18](https://github.com/ashkan18).
71
+ * [#45](https://github.com/ashkan18/graphlient/pull/45): Drop Support for Ruby 2.2 and Lock RuboCop - [@jonallured](https://github.com/jonallured).
72
+
73
+ ### 0.3.1 (2018/04/17)
74
+
75
+ * [#43](https://github.com/ashkan18/graphlient/pull/43): Allow to load and dump schema to json - [@povilasjurcys](https://github.com/povilasjurcys).
76
+
77
+ ### 0.3.0 (2018/02/22)
78
+
79
+ * [#38](https://github.com/ashkan18/graphlient/pull/38): Add support for Ruby 2.5 - [@yuki24](https://github.com/yuki24).
80
+ * [#39](https://github.com/ashkan18/graphlient/pull/39): Add support for Ruby 2.2 - [@yuki24](https://github.com/yuki24).
81
+ * [#40](https://github.com/ashkan18/graphlient/pull/40): Add experimental support for JRuby - [@yuki24](https://github.com/yuki24).
82
+
83
+ ### 0.2.0 (2017/11/09)
84
+
85
+ * [#33](https://github.com/ashkan18/graphlient/pull/33): Added dsl for supporting parametrized queries/mutations - [@ashkan18](https://github.com/ashkan18).
86
+ * [#34](https://github.com/ashkan18/graphlient/issues/34): Fix: don't convert variables to `String` - [@dblock](https://github.com/dblock).
87
+
88
+ ### 0.1.0 (2017/10/27)
89
+
90
+ * [#31](https://github.com/ashkan18/graphlient/issues/31): Fix: catch execution errors that don't contain field names - [@dblock](https://github.com/dblock).
91
+
92
+ ### 0.0.9 (2017/10/26)
93
+
94
+ * [#28](https://github.com/ashkan18/graphlient/pull/28): Raise errors in `execute`, not only `query` - [@dblock](https://github.com/dblock).
95
+ * [#29](https://github.com/ashkan18/graphlient/pull/29): Added `Graphlient::Adapters::HTTP::HTTPAdapter` that replaces Faraday with `Net::HTTP` - [@dblock](https://github.com/dblock).
96
+
97
+ ### 0.0.8 (2017/10/26)
98
+
99
+ * [#27](https://github.com/ashkan18/graphlient/pull/27): Always raise an exception unless a query has succeeded - [@dblock](https://github.com/dblock).
100
+
101
+ ### 0.0.7 (2017/10/24)
102
+
103
+ * [#26](https://github.com/ashkan18/graphlient/pull/26): Support String queries - [@dblock](https://github.com/dblock).
104
+
105
+ ### 0.0.6 (2017/10/20)
106
+
107
+ * [#14](https://github.com/ashkan18/graphlient/pull/14): Switch to `graphql-client` for network calls and schema validation - [@ashkan18](https://github.com/ashkan18).
108
+ * [#17](https://github.com/ashkan18/graphlient/pull/17): Specialize server errors as `Graphlient::Errors::Server` - [@dblock](https://github.com/dblock).
109
+ * [#13](https://github.com/ashkan18/graphlient/pull/13): Support named queries and make sure, this is braking change where we no longer support queries that don't start with `query` - [@ashkan18](https://github.com/ashkan18).
110
+ * [#21](https://github.com/ashkan18/graphlient/pull/21): Added danger, PR linter - [@dblock](https://github.com/dblock).
111
+ * [#17](https://github.com/ashkan18/graphlient/pull/17): Enable customizing of Faraday middleware - [@dblock](https://github.com/dblock).
112
+ * [#19](https://github.com/ashkan18/graphlient/pull/19): Expose `client.schema` - [@dblock](https://github.com/dblock).
113
+ * [#20](https://github.com/ashkan18/graphlient/pull/20): Added support for parameterized queries and mutations - [@dblock](https://github.com/dblock).
114
+ * [#25](https://github.com/ashkan18/graphlient/pull/25): Added `client.parse` and `client.execute` to parse and execute queries separately - [@dblock](https://github.com/dblock).
115
+
116
+ ### 0.0.5 (2017/10/05)
117
+
118
+ * [#11](https://github.com/ashkan18/graphlient/pull/11): Fixed query argument types - [@ashkan18](https://github.com/ashkan18).
119
+
120
+ ### 0.0.4 (2017/10/04)
121
+
122
+ * [#8](https://github.com/ashkan18/graphlient/pull/8): Handle HTTP errors and raise `Graphlient::Errors::HTTP` on failure - [@dblock](https://github.com/dblock).
123
+ * [#5](https://github.com/ashkan18/graphlient/pull/5): Added RuboCop, Ruby-style linter, CHANGELOG, CONTRIBUTING and RELEASING - [@dblock](https://github.com/dblock).
124
+ * [#4](https://github.com/ashkan18/graphlient/pull/4): Refactored Graphlient::Client to take a URL and options, moved extensions - [@dblock](https://github.com/dblock).
125
+
126
+ ### 0.0.3 (2017/10/03)
127
+
128
+ * Initial public release - [@ashkan18](https://github.com/ashkan18).
data/CONTRIBUTING.md CHANGED
@@ -1,125 +1,125 @@
1
- # Contributing to Graphlient
2
-
3
- This project is work of [many contributors](https://github.com/ashkan18/graphlient/graphs/contributors).
4
-
5
- You're encouraged to submit [pull requests](https://github.com/ashkan18/graphlient/pulls), [propose features and discuss issues](https://github.com/ashkan18/graphlient/issues).
6
-
7
- In the examples below, substitute your Github username for `contributor` in URLs.
8
-
9
- ### Fork the Project
10
-
11
- Fork the [project on Github](https://github.com/ashkan18/graphlient) and check out your copy.
12
-
13
- ```
14
- git clone https://github.com/contributor/graphlient.git
15
- cd graphlient
16
- git remote add upstream https://github.com/ashkan18/graphlient.git
17
- ```
18
-
19
- ### Bundle Install and Test
20
-
21
- Ensure that you can build the project and run tests.
22
-
23
- ```
24
- bundle install
25
- bundle exec rake
26
- ```
27
-
28
- ## Contribute Code
29
-
30
- ### Create a Topic Branch
31
-
32
- Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
-
34
- ```
35
- git checkout master
36
- git pull upstream master
37
- git checkout -b my-feature-branch
38
- ```
39
-
40
- ### Write Tests
41
-
42
- Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
-
44
- We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
-
46
- ### Write Code
47
-
48
- Implement your feature or bug fix.
49
-
50
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
-
52
- Make sure that `bundle exec rake` completes without errors.
53
-
54
- ### Write Documentation
55
-
56
- Document any external behavior in the [README](README.md).
57
-
58
- ### Update Changelog
59
-
60
- Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
61
-
62
- Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
-
64
- ### Commit Changes
65
-
66
- Make sure git knows your name and email address:
67
-
68
- ```
69
- git config --global user.name "Your Name"
70
- git config --global user.email "contributor@example.com"
71
- ```
72
-
73
- Writing good commit logs is important. A commit log should describe what changed and why.
74
-
75
- ```
76
- git add ...
77
- git commit
78
- ```
79
-
80
- ### Push
81
-
82
- ```
83
- git push origin my-feature-branch
84
- ```
85
-
86
- ### Make a Pull Request
87
-
88
- Go to https://github.com/contributor/graphlient and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
-
90
- ### Update CHANGELOG Again
91
-
92
- Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
-
94
- ```
95
- * [#123](https://github.com/ashkan18/graphlient/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
- ```
97
-
98
- Amend your previous commit and force push the changes.
99
-
100
- ```
101
- git commit --amend
102
- git push origin my-feature-branch -f
103
- ```
104
-
105
- ### Rebase
106
-
107
- If you've been working on a change for a while, rebase with upstream/master.
108
-
109
- ```
110
- git fetch upstream
111
- git rebase upstream/master
112
- git push origin my-feature-branch -f
113
- ```
114
-
115
- ### Check on Your Pull Request
116
-
117
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
-
119
- ### Be Patient
120
-
121
- It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
-
123
- ## Thank You
124
-
125
- Please do know that we really appreciate and value your time and work. We love you, really.
1
+ # Contributing to Graphlient
2
+
3
+ This project is work of [many contributors](https://github.com/ashkan18/graphlient/graphs/contributors).
4
+
5
+ You're encouraged to submit [pull requests](https://github.com/ashkan18/graphlient/pulls), [propose features and discuss issues](https://github.com/ashkan18/graphlient/issues).
6
+
7
+ In the examples below, substitute your Github username for `contributor` in URLs.
8
+
9
+ ### Fork the Project
10
+
11
+ Fork the [project on Github](https://github.com/ashkan18/graphlient) and check out your copy.
12
+
13
+ ```
14
+ git clone https://github.com/contributor/graphlient.git
15
+ cd graphlient
16
+ git remote add upstream https://github.com/ashkan18/graphlient.git
17
+ ```
18
+
19
+ ### Bundle Install and Test
20
+
21
+ Ensure that you can build the project and run tests.
22
+
23
+ ```
24
+ bundle install
25
+ bundle exec rake
26
+ ```
27
+
28
+ ## Contribute Code
29
+
30
+ ### Create a Topic Branch
31
+
32
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
+
34
+ ```
35
+ git checkout master
36
+ git pull upstream master
37
+ git checkout -b my-feature-branch
38
+ ```
39
+
40
+ ### Write Tests
41
+
42
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
+
44
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
+
46
+ ### Write Code
47
+
48
+ Implement your feature or bug fix.
49
+
50
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ignored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
+
52
+ Make sure that `bundle exec rake` completes without errors.
53
+
54
+ ### Write Documentation
55
+
56
+ Document any external behavior in the [README](README.md).
57
+
58
+ ### Update Changelog
59
+
60
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
61
+
62
+ Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
+
64
+ ### Commit Changes
65
+
66
+ Make sure git knows your name and email address:
67
+
68
+ ```
69
+ git config --global user.name "Your Name"
70
+ git config --global user.email "contributor@example.com"
71
+ ```
72
+
73
+ Writing good commit logs is important. A commit log should describe what changed and why.
74
+
75
+ ```
76
+ git add ...
77
+ git commit
78
+ ```
79
+
80
+ ### Push
81
+
82
+ ```
83
+ git push origin my-feature-branch
84
+ ```
85
+
86
+ ### Make a Pull Request
87
+
88
+ Go to https://github.com/contributor/graphlient and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
+
90
+ ### Update CHANGELOG Again
91
+
92
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
+
94
+ ```
95
+ * [#123](https://github.com/ashkan18/graphlient/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
+ ```
97
+
98
+ Amend your previous commit and force push the changes.
99
+
100
+ ```
101
+ git commit --amend
102
+ git push origin my-feature-branch -f
103
+ ```
104
+
105
+ ### Rebase
106
+
107
+ If you've been working on a change for a while, rebase with upstream/master.
108
+
109
+ ```
110
+ git fetch upstream
111
+ git rebase upstream/master
112
+ git push origin my-feature-branch -f
113
+ ```
114
+
115
+ ### Check on Your Pull Request
116
+
117
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
+
119
+ ### Be Patient
120
+
121
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
+
123
+ ## Thank You
124
+
125
+ Please do know that we really appreciate and value your time and work. We love you, really.
data/Dangerfile CHANGED
@@ -1,24 +1,24 @@
1
- # frozen_string_literal: true
2
-
3
- # --------------------------------------------------------------------------------------------------------------------
4
- # Has any changes happened inside the actual library code?
5
- # --------------------------------------------------------------------------------------------------------------------
6
- has_app_changes = !git.modified_files.grep(/lib/).empty?
7
- has_spec_changes = !git.modified_files.grep(/spec/).empty?
8
-
9
- # --------------------------------------------------------------------------------------------------------------------
10
- # You've made changes to lib, but didn't write any tests?
11
- # --------------------------------------------------------------------------------------------------------------------
12
- warn("There're library changes, but not tests. That's OK as long as you're refactoring existing code.", sticky: false) if has_app_changes && !has_spec_changes
13
-
14
- # --------------------------------------------------------------------------------------------------------------------
15
- # You've made changes to specs, but no library code has changed?
16
- # --------------------------------------------------------------------------------------------------------------------
17
- if !has_app_changes && has_spec_changes
18
- message('We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!', sticky: false)
19
- end
20
-
21
- # --------------------------------------------------------------------------------------------------------------------
22
- # Have you updated CHANGELOG.md?
23
- # --------------------------------------------------------------------------------------------------------------------
24
- changelog.check!
1
+ # frozen_string_literal: true
2
+
3
+ danger.import_dangerfile(gem: 'danger-pr-comment')
4
+
5
+ # --------------------------------------------------------------------------------------------------------------------
6
+ # Has any changes happened inside the actual library code?
7
+ # --------------------------------------------------------------------------------------------------------------------
8
+ has_app_changes = !git.modified_files.grep(/lib/).empty?
9
+ has_spec_changes = !git.modified_files.grep(/spec/).empty?
10
+
11
+ # --------------------------------------------------------------------------------------------------------------------
12
+ # You've made changes to lib, but didn't write any tests?
13
+ # --------------------------------------------------------------------------------------------------------------------
14
+ warn("There're library changes, but not tests. That's OK as long as you're refactoring existing code.", sticky: false) if has_app_changes && !has_spec_changes
15
+
16
+ # --------------------------------------------------------------------------------------------------------------------
17
+ # You've made changes to specs, but no library code has changed?
18
+ # --------------------------------------------------------------------------------------------------------------------
19
+ message('We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!', sticky: false) if !has_app_changes && has_spec_changes
20
+
21
+ # --------------------------------------------------------------------------------------------------------------------
22
+ # Have you updated CHANGELOG.md?
23
+ # --------------------------------------------------------------------------------------------------------------------
24
+ changelog.check!
data/Gemfile CHANGED
@@ -1,27 +1,35 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'rake'
6
-
7
- group :development, :test do
8
- gem 'activesupport', '< 6'
9
- end
10
-
11
- group :development do
12
- gem 'byebug', platform: :ruby
13
- gem 'rubocop', '0.56.0'
14
- end
15
-
16
- group :test do
17
- gem 'faraday-rack', '~> 2.0'
18
- gem 'graphql', '~> 1.9'
19
- gem 'graphql-errors'
20
- gem 'rack-parser'
21
- gem 'rack-test'
22
- gem 'rspec'
23
- gem 'rspec-mocks'
24
- gem 'sinatra'
25
- gem 'vcr'
26
- gem 'webmock'
27
- end
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rake'
6
+
7
+ group :development, :test do
8
+ gem 'activesupport', '< 6'
9
+ gem 'mutex_m' # activesupport 5.x depends on mutex_m, removed from stdlib in Ruby 3.4
10
+ gem 'ostruct'
11
+ end
12
+
13
+ group :development do
14
+ gem 'byebug', platform: :ruby
15
+ gem 'rubocop', '1.87.0'
16
+ end
17
+
18
+ group :test do
19
+ gem 'faraday-rack', '~> 2.0'
20
+ gem 'graphql', '~> 1.9'
21
+ gem 'graphql-errors'
22
+ gem 'rack-parser'
23
+ gem 'rack-test'
24
+ gem 'rspec'
25
+ gem 'rspec-mocks'
26
+ gem 'sinatra'
27
+ gem 'vcr'
28
+ gem 'webmock'
29
+ end
30
+
31
+ group :danger do
32
+ gem 'danger'
33
+ gem 'danger-changelog'
34
+ gem 'danger-pr-comment'
35
+ end