Sha256: a9458531aeb3c68cba4c6dcea7beb87cdd2d5daab66ef614f6c7ae1439fe18a4

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

module Maestrano
  module Api
    class OrganizationResource < BaseResource
      @model_class = Maestrano::Connector::Rails::Organization

      # == Attributes ===========================================================
      attribute :name
      attribute :has_account_linked
      attribute :uid
      attribute :org_uid
      attribute :account_creation_link
      attribute :displayable_synchronized_entities
      attribute :date_filtering_limit
      attribute :tenant
      attribute :provider
      attribute :sync_enabled
      attribute :entities_types

      filter :uid

      has_many :synchronizations

      def account_linked?
        @model.oauth_uid.present?
      end

      alias has_account_linked account_linked?

      def account_creation_link
        Maestrano::Connector::Rails::External.create_account_link(@model || nil)
      end

      def save
        @model.tenant = context[:client]
        super
      end

      def entities_types
        ['All', *Maestrano::Connector::Rails::IdMap.uniq.pluck(:external_entity)]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.3.6 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.5 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.4 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.3 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.2 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.1 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.3.0 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.2.1 app/resources/maestrano/api/organization_resource.rb
maestrano-connector-rails-2.2.0 app/resources/maestrano/api/organization_resource.rb