This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/routes.rb | |
Rails.application.routes.draw do | |
# MUST be declared before the mount ForestLiana::Engine. | |
namespace :forest do | |
# ... | |
delete '/LegalDoc/:id' => 'legal_docs#destroy' | |
end | |
mount ForestLiana::Engine => '/forest' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/routes.rb | |
Rails.application.routes.draw do | |
# MUST be declared before the mount ForestLiana::Engine. | |
namespace :forest do | |
# ... | |
put '/LegalDoc/:id' => 'legal_docs#update' | |
end | |
mount ForestLiana::Engine => '/forest' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/routes.rb | |
Rails.application.routes.draw do | |
# MUST be declared before the mount ForestLiana::Engine. | |
namespace :forest do | |
# ... | |
get '/LegalDoc/:id' => 'legal_docs#show' | |
end | |
mount ForestLiana::Engine => '/forest' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/routes.rb | |
Rails.application.routes.draw do | |
# MUST be declared before the mount ForestLiana::Engine. | |
namespace :forest do | |
get '/LegalDoc' => 'legal_docs#index' | |
end | |
mount ForestLiana::Engine => '/forest' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/collections/legal_doc.rb | |
class Forest::LegalDoc | |
include ForestLiana::Collection | |
collection :LegalDoc | |
field :id, type: 'String' | |
field :url, type: 'String', widget: 'link', isReadOnly: true | |
field :last_modified, type: 'Date', isReadOnly: true | |
field :size, type: 'String', isReadOnly: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/controllers/companies_controller.rb | |
if ForestLiana::UserSpace.const_defined?('CompanyController') | |
ForestLiana::UserSpace::CompanyController.class_eval do | |
# We register the default behavior method to default_destroy before the override. | |
alias_method :default_destroy, :destroy | |
def destroy | |
teams = forest_user.dig('data', 'data', 'teams') | |
if teams.include?('Management') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
source 'https://rubygems.org' | |
# ... | |
gem 'forest_liana' | |
gem 'rack-cors' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/collections/company.rb | |
class Forest::Company | |
include ForestLiana::Collection | |
collection :Company | |
action 'Whoami', type: 'global', endpoint: '/forest/whoami', http_method: 'GET' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the liana to your application's Gemfile | |
gem 'forest_liana' | |
# Bundle it | |
bundle install | |
# Install it with the provided environment secret | |
rails g forest_liana:install YOUR-SUPER-SECRET-SECRET-KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/collections/customer.rb | |
class Forest::Customer | |
include ForestLiana::Collection | |
collection :Customer | |
action 'Generate invoice', download: true | |
end |