Class: UserQuery

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/user_query.rb

Overview

Handles input from the 'Help' button and used to generate an email.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UserQuery


9
10
11
12
# File 'app/models/user_query.rb', line 9

def initialize(attributes = {})
  super
  @user_email = update_user_email
end

Instance Attribute Details

#urlObject

Returns the value of attribute url


5
6
7
# File 'app/models/user_query.rb', line 5

def url
  @url
end

#userObject

Returns the value of attribute user


5
6
7
# File 'app/models/user_query.rb', line 5

def user
  @user
end

#user_emailObject

Returns the value of attribute user_email


5
6
7
# File 'app/models/user_query.rb', line 5

def user_email
  @user_email
end

#what_expectedObject

Returns the value of attribute what_expected


5
6
7
# File 'app/models/user_query.rb', line 5

def what_expected
  @what_expected
end

#what_happenedObject

Returns the value of attribute what_happened


5
6
7
# File 'app/models/user_query.rb', line 5

def what_happened
  @what_happened
end

#what_was_trying_to_doObject

Returns the value of attribute what_was_trying_to_do


5
6
7
# File 'app/models/user_query.rb', line 5

def what_was_trying_to_do
  @what_was_trying_to_do
end

Instance Method Details

#dateObject


22
23
24
# File 'app/models/user_query.rb', line 22

def date
  Time.now.to_formatted_s(:long_ordinal)
end

#fromObject


14
15
16
# File 'app/models/user_query.rb', line 14

def from
  user_email
end

#toObject


18
19
20
# File 'app/models/user_query.rb', line 18

def to
  configatron.admin_email
end

#update_user_emailObject


26
27
28
# File 'app/models/user_query.rb', line 26

def update_user_email
  @user_email ||= (user.email if user.present?)
end