decidim-api 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/decidim/api/{types/mutation.rb → mutation_type.rb} +0 -0
- data/lib/decidim/api/{types/query.rb → query_type.rb} +0 -0
- data/lib/decidim/api.rb +2 -7
- metadata +6 -9
- data/lib/decidim/api/types/author_interface.rb +0 -13
- data/lib/decidim/api/types/localized_string.rb +0 -13
- data/lib/decidim/api/types/translated_field.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31906c3e94bb94e94f5969c88805aea760c50221
|
4
|
+
data.tar.gz: 22fb262e807e8e3e56cc209ba2a7d5fda90d3501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa27e09c7190599e526b63e54eb6caf2956529df3dd62e11d99b2e8b4e59b1cfb416ffd3378cc972b8de1ac927f39b1986b31f216b017fe1da890ce15169e8f
|
7
|
+
data.tar.gz: ad46fdb6deaf2ac0f1d19430f7171dcf63a30cb10a1691a24ed5d2046645314d807a4703e439629e4b2b3c8fe69aa6ae1a0a04fb37c0c616987625ac406b495d
|
File without changes
|
File without changes
|
data/lib/decidim/api.rb
CHANGED
@@ -5,13 +5,8 @@ module Decidim
|
|
5
5
|
# This module holds all business logic related to exposing a Public API for
|
6
6
|
# decidim.
|
7
7
|
module Api
|
8
|
-
autoload :MutationType, "decidim/api/
|
9
|
-
autoload :QueryType, "decidim/api/
|
10
|
-
autoload :AuthorInterface, "decidim/api/types/author_interface"
|
11
|
-
|
12
|
-
autoload :TranslatedFieldType, "decidim/api/types/translated_field"
|
13
|
-
autoload :LocalizedStringType, "decidim/api/types/localized_string"
|
14
|
-
|
8
|
+
autoload :MutationType, "decidim/api/mutation_type"
|
9
|
+
autoload :QueryType, "decidim/api/query_type"
|
15
10
|
autoload :Schema, "decidim/api/schema"
|
16
11
|
end
|
17
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-02-
|
13
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -94,14 +94,14 @@ dependencies:
|
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.0.
|
97
|
+
version: 0.0.5
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.0.
|
104
|
+
version: 0.0.5
|
105
105
|
description: API engine for decidim
|
106
106
|
email:
|
107
107
|
- josepjaume@gmail.com
|
@@ -124,13 +124,10 @@ files:
|
|
124
124
|
- lib/decidim/api.rb
|
125
125
|
- lib/decidim/api/engine.rb
|
126
126
|
- lib/decidim/api/graphiql-initial-query.txt
|
127
|
+
- lib/decidim/api/mutation_type.rb
|
128
|
+
- lib/decidim/api/query_type.rb
|
127
129
|
- lib/decidim/api/schema.rb
|
128
130
|
- lib/decidim/api/test/type_context.rb
|
129
|
-
- lib/decidim/api/types/author_interface.rb
|
130
|
-
- lib/decidim/api/types/localized_string.rb
|
131
|
-
- lib/decidim/api/types/mutation.rb
|
132
|
-
- lib/decidim/api/types/query.rb
|
133
|
-
- lib/decidim/api/types/translated_field.rb
|
134
131
|
- lib/tasks/decidim/api_tasks.rake
|
135
132
|
- vendor/assets/javascripts/decidim/api/graphql-docs.js
|
136
133
|
- vendor/assets/javascripts/decidim/api/react-dom.js
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Decidim
|
3
|
-
module Api
|
4
|
-
# This interface represents an author who owns a resource.
|
5
|
-
AuthorInterface = GraphQL::InterfaceType.define do
|
6
|
-
name "Author"
|
7
|
-
description "An author"
|
8
|
-
|
9
|
-
field :name, !types.String, "The author's name"
|
10
|
-
field :avatarUrl, !types.String, "The author's avatar url"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Decidim
|
3
|
-
module Api
|
4
|
-
# This type represents a localized string in a single language.
|
5
|
-
LocalizedStringType = GraphQL::ObjectType.define do
|
6
|
-
name "LocalizedString"
|
7
|
-
description "Represents a particular translation of a LocalizedStringType"
|
8
|
-
|
9
|
-
field :locale, !types.String, "The standard locale of this translation."
|
10
|
-
field :text, types.String, "The content of this translation."
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Decidim
|
3
|
-
module Api
|
4
|
-
# This type represents a translated field in multiple languages.
|
5
|
-
TranslatedFieldType = GraphQL::ObjectType.define do
|
6
|
-
name "TranslatedField"
|
7
|
-
description "A translated field"
|
8
|
-
|
9
|
-
field :locales do
|
10
|
-
type types[types.String]
|
11
|
-
description "Lists all the locales in which this translation is available"
|
12
|
-
resolve ->(obj, _args, _ctx) { obj.keys }
|
13
|
-
end
|
14
|
-
|
15
|
-
field :translations do
|
16
|
-
type !types[LocalizedStringType]
|
17
|
-
description "All the localized strings for this translation."
|
18
|
-
|
19
|
-
argument :locales do
|
20
|
-
type types[types.String]
|
21
|
-
description "A list of locales to scope the translations to."
|
22
|
-
end
|
23
|
-
|
24
|
-
resolve ->(obj, args, _ctx) {
|
25
|
-
translations = obj.stringify_keys
|
26
|
-
translations = translations.slice(*args["locales"]) if args["locales"]
|
27
|
-
|
28
|
-
translations.map { |locale, text| OpenStruct.new(locale: locale, text: text) }
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
field :translation do
|
33
|
-
type types.String
|
34
|
-
description "Returns a single translation given a locale."
|
35
|
-
argument :locale, !types.String, "A locale to search for"
|
36
|
-
|
37
|
-
resolve ->(obj, args, _ctx) {
|
38
|
-
translations = obj.stringify_keys
|
39
|
-
translations[args["locale"]]
|
40
|
-
}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|