story_branch-graphql 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/standard.yml +13 -0
- data/.vscode/settings.json +7 -0
- data/Rakefile +1 -1
- data/lib/story_branch/graphql/client.rb +6 -6
- data/lib/story_branch/graphql/response.rb +5 -5
- data/lib/story_branch/graphql/version.rb +1 -1
- data/lib/story_branch/graphql.rb +2 -2
- data/story_branch-graphql.gemspec +19 -19
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2d1763ada0abfd2bc9218d06040e0f9833b8419a6b42000eb688e467408fd7c
|
4
|
+
data.tar.gz: 2acd7d89b26bb5f8959e03656725e58667c117796552bc240855b1007e60b2dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6abf7dd3c3d3075474e38a37ea8dd36773aca0d5002e0ccc930721f806df373c4f72d316f1c6a7bf2c0cf03374254509c2ce8b619da0bc13c638d7b5b853cce
|
7
|
+
data.tar.gz: 9266e43a940ee32cd819ab50837be703916ad287333bd2a4709c1b0582c12327170f4f5ca9de5394eaa98ad0294a15bbb0f4c878ecc624a4a0c2ae2a5f48bf33
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
3
|
+
require "httparty"
|
4
|
+
require_relative "response"
|
5
5
|
|
6
6
|
module StoryBranch
|
7
7
|
module Graphql
|
@@ -13,12 +13,12 @@ module StoryBranch
|
|
13
13
|
@auth = api_key
|
14
14
|
end
|
15
15
|
|
16
|
-
def get(graphql_query:, endpoint:
|
16
|
+
def get(graphql_query:, endpoint: "graphql")
|
17
17
|
body_json = query_params_json(graphql_query)
|
18
18
|
|
19
19
|
gql_response = HTTParty.post(graphql_endpoint(endpoint), headers: headers, body: body_json)
|
20
20
|
response = StoryBranch::Graphql::Response.new(response: gql_response)
|
21
|
-
raise
|
21
|
+
raise Error, response.full_error_messages unless response.success?
|
22
22
|
|
23
23
|
response
|
24
24
|
end
|
@@ -32,12 +32,12 @@ module StoryBranch
|
|
32
32
|
def headers
|
33
33
|
{
|
34
34
|
Authorization: @auth,
|
35
|
-
|
35
|
+
"Content-Type": "application/json"
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
39
|
def query_params_json(graphql_query)
|
40
|
-
{
|
40
|
+
{query: graphql_query}.to_json
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -9,7 +9,7 @@ module StoryBranch
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def data
|
12
|
-
@data ||= @response.parsed_response[
|
12
|
+
@data ||= @response.parsed_response["data"]
|
13
13
|
end
|
14
14
|
|
15
15
|
def success?
|
@@ -20,10 +20,10 @@ module StoryBranch
|
|
20
20
|
return @errors if @errors
|
21
21
|
|
22
22
|
@errors = if @response.success?
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
@response.parsed_response["errors"]
|
24
|
+
else
|
25
|
+
[@response.response, @response.parsed_response]
|
26
|
+
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def full_error_messages
|
data/lib/story_branch/graphql.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/story_branch/graphql/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version
|
6
|
-
spec.authors
|
7
|
-
spec.email
|
4
|
+
spec.name = "story_branch-graphql"
|
5
|
+
spec.version = StoryBranch::Graphql::VERSION
|
6
|
+
spec.authors = ["Rui Baltazar"]
|
7
|
+
spec.email = ["rui.p.baltazar@gmail.com"]
|
8
8
|
|
9
|
-
spec.summary
|
10
|
-
spec.description
|
9
|
+
spec.summary = "Very simple GraphQL client"
|
10
|
+
spec.description = <<~DESCRIPTION
|
11
11
|
This simple gem allows you to make GraphQL requests and parses the response
|
12
12
|
into a simple structure with helper methods to validate if it's a successful
|
13
13
|
response or not
|
14
14
|
DESCRIPTION
|
15
|
-
spec.homepage
|
16
|
-
spec.license
|
15
|
+
spec.homepage = "https://github.com/story-branch/sb_graphql_client"
|
16
|
+
spec.license = "MIT"
|
17
17
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
18
18
|
|
19
19
|
spec.metadata = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
"bug_tracker_uri" => "https://github.com/story-branch/sb_graphql_client/issues",
|
21
|
+
"changelog_uri" => "https://github.com/story-branch/sb_graphql_client/blob/master/Changelog.md",
|
22
|
+
"documentation_uri" => "https://github.com/story-branch/sb_graphql_client/blob/master/README.md",
|
23
|
+
"source_code_uri" => "https://github.com/story-branch/sb_graphql_client",
|
24
|
+
"homepage_uri" => spec.homepage
|
25
25
|
}
|
26
26
|
|
27
27
|
# Specify which files should be added to the gem when it is released.
|
28
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
-
spec.files
|
29
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
30
30
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
31
|
end
|
32
|
-
spec.bindir
|
33
|
-
spec.executables
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
-
spec.add_runtime_dependency
|
36
|
+
spec.add_runtime_dependency "httparty", ">0"
|
37
37
|
|
38
|
-
spec.add_development_dependency
|
38
|
+
spec.add_development_dependency "standard", "~> 1.15"
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: story_branch-graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Baltazar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -48,8 +48,10 @@ executables: []
|
|
48
48
|
extensions: []
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
|
+
- ".github/workflows/standard.yml"
|
51
52
|
- ".gitignore"
|
52
53
|
- ".travis.yml"
|
54
|
+
- ".vscode/settings.json"
|
53
55
|
- CODE_OF_CONDUCT.md
|
54
56
|
- Gemfile
|
55
57
|
- LICENSE
|