elasticgraph-graphql 1.0.0.rc3 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d3ea8e667b4cebb37bc0f787dc16fbe01d09ac5937520ceb895c7dfd41dfba9
4
- data.tar.gz: ca44dc9ae6aab319cfde4b388ad64eb60cae496de61bc6ab7772e8cb1c1d9f74
3
+ metadata.gz: 292dd7f883e879246db01931fce87901d6aaca61601e3f7dce9f55d260a79d57
4
+ data.tar.gz: 1c279ea0afb9ba322edf21e9ca0d145863da3858c9174c37cf27dc2726afbabe
5
5
  SHA512:
6
- metadata.gz: 51700b27c00b46f437161aa2e23a68b5824d5dc4c80432837e7b420a63dcd7bab0297946b29955711956f7a2c5f7151b587c17fa57d62413562060fa135e7a46
7
- data.tar.gz: 1c035635cb5227ea9c56133f585f85938faaef1ed3fc7aec0cfb3c104421fa92762a3d2ab054dc006f890cf5cb053adbdebcd2c6141e4ba5b3906e40dd741f56
6
+ metadata.gz: 338b16f44b60f735165d3e159512b65fe54474b1562f6a51da0a5c583838b635c2d2f5ad2d4e5d99a96296c42aa53cb3aecdcddb3a440f4935e2fc467c59f5af
7
+ data.tar.gz: 85a4a05c596ef358b9c28d3faa0f0467508c44c6e813e92ba5fa36997220d509e577e4666c6a29dac83bd877df22670092e8b922e5264a538eb1c5330ea576ec
data/README.md CHANGED
@@ -54,3 +54,15 @@ graph LR;
54
54
  click graphql href "https://rubygems.org/gems/graphql" "Open on RubyGems.org" _blank;
55
55
  click graphql-c_parser href "https://rubygems.org/gems/graphql-c_parser" "Open on RubyGems.org" _blank;
56
56
  ```
57
+
58
+ ## Usage
59
+
60
+ Most of the time, an `elasticgraph-graphql` endpoint is served via HTTP using `elasticgraph-rack` or `elasticgraph-graphql_lambda`.
61
+ However, you can interact with it directly in Ruby:
62
+
63
+ ```ruby
64
+ require "elastic_graph/graphql"
65
+
66
+ graphql = ElasticGraph::GraphQL.from_yaml_file("config/settings/local.yaml")
67
+ graphql.graphql_query_executor.execute("query { __typename }") # Returns a GraphQL response.
68
+ ```
@@ -98,7 +98,7 @@ module ElasticGraph
98
98
  def with_request_params(request)
99
99
  params =
100
100
  # POST with application/json is the most common form requests take, so we have it as the first branch here.
101
- if request.http_method == :post && request.content_type == APPLICATION_JSON
101
+ if request.http_method == :post && request.mime_type == APPLICATION_JSON
102
102
  begin
103
103
  ::JSON.parse(request.body.to_s)
104
104
  rescue ::JSON::ParserError
@@ -107,11 +107,11 @@ module ElasticGraph
107
107
  # standard:enable Lint/NoReturnInBeginEndBlocks
108
108
  end
109
109
 
110
- elsif request.http_method == :post && request.content_type == APPLICATION_GRAPHQL
110
+ elsif request.http_method == :post && request.mime_type == APPLICATION_GRAPHQL
111
111
  {"query" => request.body}
112
112
 
113
113
  elsif request.http_method == :post
114
- return HTTPResponse.error(415, "`#{request.content_type}` is not a supported content type. Only `#{APPLICATION_JSON}` and `#{APPLICATION_GRAPHQL}` are supported.")
114
+ return HTTPResponse.error(415, "`#{request.mime_type}` is not a supported content type. Only `#{APPLICATION_JSON}` and `#{APPLICATION_GRAPHQL}` are supported.")
115
115
 
116
116
  elsif request.http_method == :get
117
117
  ::URI.decode_www_form(::URI.parse(request.url).query.to_s).to_h.tap do |hash|
@@ -196,8 +196,8 @@ module ElasticGraph
196
196
  end
197
197
  end
198
198
 
199
- def content_type
200
- normalized_headers["CONTENT-TYPE"]
199
+ def mime_type
200
+ @mime_type ||= normalized_headers["CONTENT-TYPE"].to_s.split(";").first # strip ; delimiter and any trailing parameters
201
201
  end
202
202
 
203
203
  def self.normalize_header_name(header)
@@ -60,22 +60,5 @@ if ARGV.include?("--print")
60
60
  else
61
61
  filename = "#{__dir__}/../lib/elastic_graph/graphql/scalar_coercion_adapters/valid_time_zones.rb"
62
62
  ::FileUtils.cp(updated_code_filename, filename)
63
- puts "Timezones have been written to `#{filename}`"
63
+ puts "Time zones have been written to `#{filename}`"
64
64
  end
65
-
66
- # if ARGV.include?("--verify")
67
- # existing_contents = ::File.exist?(filename) ? ::File.read(filename) : ""
68
- #
69
- # if existing_contents == valid_timezones_ruby_code
70
- # puts "`#{filename}` is up to date!"
71
- # else
72
- # diff = `git diff --no-index #{"--color" if $stdout.tty?} --binary #{updated_code_filename} #{filename}`
73
- #
74
- # abort <<~EOS.strip
75
- # `#{filename}` is not up to date! Rerun `script/dump_time_zones` to correct.
76
- #
77
- # #{diff}
78
- # EOS
79
- # end
80
- # else
81
- # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticgraph-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -31,28 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 1.0.0.rc3
34
+ version: 1.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.0.0.rc3
41
+ version: 1.0.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: elasticgraph-schema_artifacts
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.0.0.rc3
48
+ version: 1.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.0.0.rc3
55
+ version: 1.0.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: graphql
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -93,70 +93,70 @@ dependencies:
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.0.0.rc3
96
+ version: 1.0.0
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0.rc3
103
+ version: 1.0.0
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: elasticgraph-elasticsearch
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.0.rc3
110
+ version: 1.0.0
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.0.0.rc3
117
+ version: 1.0.0
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: elasticgraph-opensearch
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.0.0.rc3
124
+ version: 1.0.0
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.0.0.rc3
131
+ version: 1.0.0
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: elasticgraph-indexer
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.0.0.rc3
138
+ version: 1.0.0
139
139
  type: :development
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 1.0.0.rc3
145
+ version: 1.0.0
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: elasticgraph-schema_definition
148
148
  requirement: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 1.0.0.rc3
152
+ version: 1.0.0
153
153
  type: :development
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 1.0.0.rc3
159
+ version: 1.0.0
160
160
  email:
161
161
  - myron@squareup.com
162
162
  executables: []
@@ -247,10 +247,10 @@ licenses:
247
247
  - MIT
248
248
  metadata:
249
249
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
250
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc3
251
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc3/
250
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0
251
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0/
252
252
  homepage_uri: https://block.github.io/elasticgraph/
253
- source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc3/elasticgraph-graphql
253
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0/elasticgraph-graphql
254
254
  gem_category: core
255
255
  rdoc_options: []
256
256
  require_paths:
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubygems_version: 3.6.7
272
+ rubygems_version: 3.6.9
273
273
  specification_version: 4
274
- summary: The ElasticGraph GraphQL query engine.
274
+ summary: Provides the ElasticGraph GraphQL query engine.
275
275
  test_files: []