Module: Umami::Models

Defined in:
lib/umami/models.rb,
lib/umami/models/team.rb,
lib/umami/models/user.rb,
lib/umami/models/report.rb,
lib/umami/models/session.rb,
lib/umami/models/version.rb,
lib/umami/models/website.rb,
lib/umami/models/team_user.rb,
lib/umami/models/event_data.rb,
lib/umami/models/session_data.rb,
lib/umami/models/website_event.rb

Overview

Provides read-only ActiveRecord models for accessing Umami Analytics data

Defined Under Namespace

Classes: Base, Error, EventData, Report, Session, SessionData, Team, TeamUser, User, Website, WebsiteEvent

Constant Summary collapse

VERSION =
"0.1.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.databaseObject

Returns the value of attribute database.



12
13
14
# File 'lib/umami/models.rb', line 12

def database
  @database
end

Class Method Details

.apply_configuration!Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/umami/models.rb', line 19

def apply_configuration!
  return unless database

  # Apply to Base and all its descendants
  if database.is_a?(Hash)
    Base.connects_to database: database
  else
    Base.connects_to database: { writing: database, reading: database }
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Umami::Models)

    the object that the method was called on



14
15
16
17
# File 'lib/umami/models.rb', line 14

def configure
  yield self
  apply_configuration! if database
end