forest_liana 1.1.20 → 1.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/forest_liana/apimaps_controller.rb +1 -1
- data/app/models/forest_liana/model/action.rb +22 -0
- data/app/models/forest_liana/model/collection.rb +24 -0
- data/app/models/forest_liana/model/stat.rb +22 -0
- data/app/serializers/forest_liana/action_serializer.rb +18 -0
- data/app/serializers/forest_liana/collection_serializer.rb +20 -0
- data/app/serializers/forest_liana/serializer_factory.rb +5 -3
- data/app/services/forest_liana/collection.rb +27 -0
- data/app/services/forest_liana/line_stat_getter.rb +1 -1
- data/app/services/forest_liana/pie_stat_getter.rb +1 -1
- data/app/services/forest_liana/schema_adapter.rb +1 -1
- data/app/services/forest_liana/value_stat_getter.rb +1 -1
- data/lib/forest_liana.rb +1 -1
- data/lib/forest_liana/engine.rb +4 -5
- data/lib/forest_liana/version.rb +1 -1
- metadata +8 -6
- data/app/models/forest_liana/collection.rb +0 -26
- data/app/models/forest_liana/stat.rb +0 -26
- data/app/serializers/forest_liana/apimap_serializer.rb +0 -10
- data/app/services/forest_liana/smart_collection.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21865b20b7689f8391863232851fae17d931a22f
|
4
|
+
data.tar.gz: f9fc1e5fcaee763363eb1cf08f938f729e34a4fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ea6edeb1719c0f12cc49a99610cbd2ce5117d9347569602814c8efe7f3bc87c4af283ed570bc1d5a82c8a00a3593f6766188de8e9c736bf2aa3d37a771aa95
|
7
|
+
data.tar.gz: be1c07ed787bee9dfcbf38a7153d7c624afb280c7cb8c36601de06c60377bb07b3dd6863effb233c3e32d83e4814c139ed2eae21d2942ce5df1b6a8680e65a3e
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ForestLiana::Model::Action
|
2
|
+
include ActiveModel::Validations
|
3
|
+
include ActiveModel::Conversion
|
4
|
+
include ActiveModel::Serialization
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
|
7
|
+
attr_accessor :name, :endpoint, :http_method, :fields
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
attributes.each do |name, value|
|
11
|
+
send("#{name}=", value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def persisted?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def id
|
20
|
+
name
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class ForestLiana::Model::Collection
|
2
|
+
include ActiveModel::Validations
|
3
|
+
include ActiveModel::Conversion
|
4
|
+
include ActiveModel::Serialization
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
|
7
|
+
attr_accessor :name, :fields, :actions
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
@actions = []
|
11
|
+
|
12
|
+
attributes.each do |name, value|
|
13
|
+
send("#{name}=", value)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def persisted?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
def id
|
22
|
+
name
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ForestLiana::Model::Stat
|
2
|
+
include ActiveModel::Validations
|
3
|
+
include ActiveModel::Conversion
|
4
|
+
include ActiveModel::Serialization
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
|
7
|
+
attr_accessor :value
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
attributes.each do |name, value|
|
11
|
+
send("#{name}=", value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def persisted?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def id
|
20
|
+
SecureRandom.uuid
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'jsonapi-serializers'
|
2
|
+
|
3
|
+
class ForestLiana::ActionSerializer
|
4
|
+
include JSONAPI::Serializer
|
5
|
+
|
6
|
+
attribute :name
|
7
|
+
attribute :http_method
|
8
|
+
attribute :endpoint
|
9
|
+
attribute :fields
|
10
|
+
|
11
|
+
def relationship_related_link(attribute_name)
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def relationship_self_link(attribute_name)
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'jsonapi-serializers'
|
2
|
+
|
3
|
+
class ForestLiana::CollectionSerializer
|
4
|
+
include JSONAPI::Serializer
|
5
|
+
|
6
|
+
attribute :name
|
7
|
+
attribute :fields
|
8
|
+
|
9
|
+
has_many :actions do
|
10
|
+
object.actions
|
11
|
+
end
|
12
|
+
|
13
|
+
def relationship_related_link(attribute_name)
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def relationship_self_link(attribute_name)
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
@@ -20,10 +20,12 @@ module ForestLiana
|
|
20
20
|
"ForestLiana::StripeCardSerializer"
|
21
21
|
elsif active_record_class == Stripe::Invoice
|
22
22
|
"ForestLiana::StripeInvoiceSerializer"
|
23
|
-
elsif active_record_class == ForestLiana::Stat
|
23
|
+
elsif active_record_class == ForestLiana::Model::Stat
|
24
24
|
"ForestLiana::StatSerializer"
|
25
|
-
elsif active_record_class == ForestLiana::Collection
|
26
|
-
"ForestLiana::
|
25
|
+
elsif active_record_class == ForestLiana::Model::Collection
|
26
|
+
"ForestLiana::CollectionSerializer"
|
27
|
+
elsif active_record_class == ForestLiana::Model::Action
|
28
|
+
"ForestLiana::ActionSerializer"
|
27
29
|
else
|
28
30
|
class_name = active_record_class.table_name.classify
|
29
31
|
module_name = class_name.deconstantize
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ForestLiana::Collection
|
2
|
+
mattr_accessor :collection_name
|
3
|
+
|
4
|
+
def self.fields(fields)
|
5
|
+
collection = ForestLiana::Model::Collection.new({
|
6
|
+
name: self.collection_name,
|
7
|
+
fields: fields
|
8
|
+
})
|
9
|
+
|
10
|
+
ForestLiana.apimap << collection
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.action(name, opts = {})
|
14
|
+
collection = ForestLiana.apimap.find do |x|
|
15
|
+
x.name == self.collection_name.try(:to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
return if collection.blank?
|
19
|
+
|
20
|
+
collection.actions << ForestLiana::Model::Action.new({
|
21
|
+
name: name,
|
22
|
+
http_method: opts[:http_method],
|
23
|
+
endpoint: opts[:endpoint],
|
24
|
+
fields: opts[:fields]
|
25
|
+
})
|
26
|
+
end
|
27
|
+
end
|
data/lib/forest_liana.rb
CHANGED
data/lib/forest_liana/engine.rb
CHANGED
@@ -9,10 +9,6 @@ module ForestLiana
|
|
9
9
|
isolate_namespace ForestLiana
|
10
10
|
logger = Logger.new(STDOUT)
|
11
11
|
|
12
|
-
initializer 'forest_liana.require_all' do |app|
|
13
|
-
Dir["#{app.root}/app/models/forest/*.rb"].each {|file| require file }
|
14
|
-
end
|
15
|
-
|
16
12
|
config.middleware.insert_before 0, 'Rack::Cors' do
|
17
13
|
allow do
|
18
14
|
origins 'http://localhost:4200', 'https://www.forestadmin.com',
|
@@ -21,7 +17,7 @@ module ForestLiana
|
|
21
17
|
end
|
22
18
|
end
|
23
19
|
|
24
|
-
config.after_initialize do
|
20
|
+
config.after_initialize do |app|
|
25
21
|
unless Rails.env.test?
|
26
22
|
SchemaUtils.tables_names.map do |table_name|
|
27
23
|
model = SchemaUtils.find_model_from_table_name(table_name)
|
@@ -48,10 +44,13 @@ module ForestLiana
|
|
48
44
|
end
|
49
45
|
end
|
50
46
|
|
47
|
+
Dir["#{app.root}/app/models/forest/*.rb"].each {|file| require file }
|
48
|
+
|
51
49
|
liana_version = Gem::Specification.find_by_name('forest_liana')
|
52
50
|
.version.to_s
|
53
51
|
json = JSONAPI::Serializer.serialize(ForestLiana.apimap, {
|
54
52
|
is_collection: true,
|
53
|
+
include: ['actions'],
|
55
54
|
meta: { liana: 'forest-rails', liana_version: liana_version }
|
56
55
|
})
|
57
56
|
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -129,14 +129,17 @@ files:
|
|
129
129
|
- app/controllers/forest_liana/stripe_controller.rb
|
130
130
|
- app/deserializers/forest_liana/resource_deserializer.rb
|
131
131
|
- app/helpers/forest_liana/application_helper.rb
|
132
|
-
- app/models/forest_liana/
|
133
|
-
- app/models/forest_liana/
|
134
|
-
- app/
|
132
|
+
- app/models/forest_liana/model/action.rb
|
133
|
+
- app/models/forest_liana/model/collection.rb
|
134
|
+
- app/models/forest_liana/model/stat.rb
|
135
|
+
- app/serializers/forest_liana/action_serializer.rb
|
136
|
+
- app/serializers/forest_liana/collection_serializer.rb
|
135
137
|
- app/serializers/forest_liana/serializer_factory.rb
|
136
138
|
- app/serializers/forest_liana/stat_serializer.rb
|
137
139
|
- app/serializers/forest_liana/stripe_card_serializer.rb
|
138
140
|
- app/serializers/forest_liana/stripe_invoice_serializer.rb
|
139
141
|
- app/serializers/forest_liana/stripe_payment_serializer.rb
|
142
|
+
- app/services/forest_liana/collection.rb
|
140
143
|
- app/services/forest_liana/has_many_getter.rb
|
141
144
|
- app/services/forest_liana/line_stat_getter.rb
|
142
145
|
- app/services/forest_liana/operator_value_parser.rb
|
@@ -147,7 +150,6 @@ files:
|
|
147
150
|
- app/services/forest_liana/schema_adapter.rb
|
148
151
|
- app/services/forest_liana/schema_utils.rb
|
149
152
|
- app/services/forest_liana/search_query_builder.rb
|
150
|
-
- app/services/forest_liana/smart_collection.rb
|
151
153
|
- app/services/forest_liana/stripe_cards_getter.rb
|
152
154
|
- app/services/forest_liana/stripe_invoices_getter.rb
|
153
155
|
- app/services/forest_liana/stripe_payment_refunder.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module ForestLiana
|
2
|
-
class Collection
|
3
|
-
|
4
|
-
include ActiveModel::Validations
|
5
|
-
include ActiveModel::Conversion
|
6
|
-
include ActiveModel::Serialization
|
7
|
-
extend ActiveModel::Naming
|
8
|
-
|
9
|
-
attr_accessor :name, :fields
|
10
|
-
|
11
|
-
def initialize(attributes = {})
|
12
|
-
attributes.each do |name, value|
|
13
|
-
send("#{name}=", value)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def persisted?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
|
-
def id
|
22
|
-
name
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module ForestLiana
|
2
|
-
class Stat
|
3
|
-
|
4
|
-
include ActiveModel::Validations
|
5
|
-
include ActiveModel::Conversion
|
6
|
-
include ActiveModel::Serialization
|
7
|
-
extend ActiveModel::Naming
|
8
|
-
|
9
|
-
attr_accessor :value
|
10
|
-
|
11
|
-
def initialize(attributes = {})
|
12
|
-
attributes.each do |name, value|
|
13
|
-
send("#{name}=", value)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def persisted?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
|
-
def id
|
22
|
-
SecureRandom.uuid
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|