recline 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9861c39716e17c3dd5f127d7c2f4164a08f144d6
4
- data.tar.gz: 5f6757a33cdc34d55b3e59ccbf90f78d6e514ad8
3
+ metadata.gz: ee53a57c2187d6c4811a6162030d4f319e8ffda7
4
+ data.tar.gz: dadb52ecb66240227418c5916bb4c6c99d0d4993
5
5
  SHA512:
6
- metadata.gz: 29c59aa2cc8b37c549d4b75d2a34fe4ebcc9918e69ca6bf66480dad2cf1eae401a2d1d76595fcd1bb34ea1de93763cd509b5a323537ca5c0d9614adb805bd4fb
7
- data.tar.gz: 6345aeaca86130e6d9822e63309a1d04e98248913810d73d13aec23fee3792f26e05a106aa49f137cd5f65a5812f24a638e5921e5439f88f3768c099f31889f8
6
+ metadata.gz: 12bdd73f01bdf4a156608b48d15c2bc63e479aca5173f75be160c9722ed487b843ea10800c8152caec95977a7263374a19135f810b7c3615611a6d35cd8e28c5
7
+ data.tar.gz: ed33d090bb91050887d9ade3f5dfbdeba6c5707c93c703294eec97ee49a17099c2faefdbe5869d228c0ad07cc723025ce939513f82c41974e838b09dec13bdf5
@@ -1,7 +1,14 @@
1
1
  require 'graphql/rails/active_reflection/model_reflection'
2
2
 
3
3
  class Recline::ModelReflection < GraphQL::Rails::ActiveReflection::ModelReflection
4
- @schema_name = "ReclineModel"
4
+ @schema_name = "ReclineMode"
5
+
6
+ attr_reader :versions
7
+
8
+ def initialize(obj, ctx)
9
+ super
10
+ @versions = obj.versions if obj.respond_to? :versions
11
+ end
5
12
 
6
13
  def get_attributes
7
14
  @attributes ||= @type.fields.map { |name, field|
@@ -2,6 +2,16 @@ module Recline
2
2
  class Railtie < Rails::Railtie
3
3
  config.before_configuration do
4
4
  GraphQL::Field.accepts_definitions(recline_appearance: GraphQL::Define.assign_metadata_key(:recline_appearance))
5
+
6
+ begin
7
+ require "paper_trail"
8
+ require "recline/types/version_reflection_type"
9
+ Recline::Types::ModelReflectionType.define do
10
+ field :versions, Recline::Types::VersionReflectionType.to_list_type
11
+ end
12
+ rescue LoadError
13
+ # not installed
14
+ end
5
15
  end
6
16
  end
7
17
  end
@@ -0,0 +1,6 @@
1
+ Recline::Types::DiffType = GraphQL::ObjectType.define do
2
+ name 'ReclineDiff'
3
+ field :attribute, !types.String
4
+ field :before, types.String
5
+ field :after, types.String
6
+ end
@@ -0,0 +1,11 @@
1
+ require 'graphql/rails/active_reflection'
2
+ require 'graphql/rails/active_reflection/types/attribute_reflection_type'
3
+ require 'recline/types/diff_type'
4
+
5
+ Recline::Types::VersionReflectionType = GraphQL::ObjectType.define do
6
+ name "ReclineVersion"
7
+ field :title, types.String
8
+ field :created_at, types.String
9
+
10
+ field :diff, Recline::Types::DiffType.to_list_type
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Recline
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-29 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -94,7 +94,9 @@ files:
94
94
  - lib/recline/railtie.rb
95
95
  - lib/recline/types/appearance_enum_type.rb
96
96
  - lib/recline/types/attribute_reflection_type.rb
97
+ - lib/recline/types/diff_type.rb
97
98
  - lib/recline/types/model_reflection_type.rb
99
+ - lib/recline/types/version_reflection_type.rb
98
100
  - lib/recline/version.rb
99
101
  homepage: http://rubygems.org/gems/recline
100
102
  licenses: