Class: SendGrid::Ganalytics

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid/helpers/mail/ganalytics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enable: nil, utm_source: nil, utm_medium: nil, utm_term: nil, utm_content: nil, utm_campaign: nil, utm_name: nil) ⇒ Ganalytics

Returns a new instance of Ganalytics.


7
8
9
10
11
12
13
14
15
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 7

def initialize(enable: nil, utm_source: nil, utm_medium: nil, utm_term: nil, utm_content: nil, utm_campaign: nil, utm_name: nil)
  @enable = enable
  @utm_source = utm_source
  @utm_medium = utm_medium
  @utm_term = utm_term
  @utm_content = utm_content
  @utm_campaign = utm_campaign
  @utm_name = utm_name
end

Instance Attribute Details

#enableObject

Returns the value of attribute enable


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def enable
  @enable
end

#utm_campaignObject

Returns the value of attribute utm_campaign


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_campaign
  @utm_campaign
end

#utm_contentObject

Returns the value of attribute utm_content


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_content
  @utm_content
end

#utm_mediumObject

Returns the value of attribute utm_medium


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_medium
  @utm_medium
end

#utm_nameObject

Returns the value of attribute utm_name


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_name
  @utm_name
end

#utm_sourceObject

Returns the value of attribute utm_source


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_source
  @utm_source
end

#utm_termObject

Returns the value of attribute utm_term


5
6
7
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 5

def utm_term
  @utm_term
end

Instance Method Details

#to_jsonObject


17
18
19
20
21
22
23
24
25
26
# File 'lib/sendgrid/helpers/mail/ganalytics.rb', line 17

def to_json(*)
  {
    'enable' => enable,
    'utm_source' => utm_source,
    'utm_medium' => utm_medium,
    'utm_term' => utm_term,
    'utm_content' => utm_content,
    'utm_campaign' => utm_campaign
  }.delete_if { |_, value| value.to_s.strip == '' }
end