Class: MoesifApi::CampaignModel
- Defined in:
- lib/moesif_api/models/campaign_model.rb
Instance Attribute Summary collapse
-
#gclid ⇒ String
the gclid.
-
#referrer ⇒ String
the referrer.
-
#referring_domain ⇒ String
the referring domain.
-
#utm_campaign ⇒ String
the utm campaign.
-
#utm_content ⇒ String
the utm content.
-
#utm_medium ⇒ String
the utm medium.
-
#utm_source ⇒ String
the utm source.
-
#utm_term ⇒ String
the utm term.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(utm_source = nil, utm_medium = nil, utm_campaign = nil, utm_term = nil, utm_content = nil, referrer = nil, referring_domain = nil, gclid = nil) ⇒ CampaignModel
constructor
A new instance of CampaignModel.
Methods inherited from BaseModel
#clean_str, #to_hash, #to_json
Constructor Details
#initialize(utm_source = nil, utm_medium = nil, utm_campaign = nil, utm_term = nil, utm_content = nil, referrer = nil, referring_domain = nil, gclid = nil) ⇒ CampaignModel
Returns a new instance of CampaignModel.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/moesif_api/models/campaign_model.rb', line 53 def initialize(utm_source = nil, utm_medium = nil, utm_campaign = nil, utm_term = nil, utm_content = nil, referrer = nil, referring_domain = nil, gclid = nil) @utm_source = utm_source @utm_medium = utm_medium @utm_campaign = utm_campaign @utm_term = utm_term @utm_content = utm_content @referrer = referrer @referring_domain = referring_domain @gclid = gclid end |
Instance Attribute Details
#gclid ⇒ String
the gclid
35 36 37 |
# File 'lib/moesif_api/models/campaign_model.rb', line 35 def gclid @gclid end |
#referrer ⇒ String
the referrer
27 28 29 |
# File 'lib/moesif_api/models/campaign_model.rb', line 27 def referrer @referrer end |
#referring_domain ⇒ String
the referring domain
31 32 33 |
# File 'lib/moesif_api/models/campaign_model.rb', line 31 def referring_domain @referring_domain end |
#utm_campaign ⇒ String
the utm campaign
15 16 17 |
# File 'lib/moesif_api/models/campaign_model.rb', line 15 def utm_campaign @utm_campaign end |
#utm_content ⇒ String
the utm content
23 24 25 |
# File 'lib/moesif_api/models/campaign_model.rb', line 23 def utm_content @utm_content end |
#utm_medium ⇒ String
the utm medium
11 12 13 |
# File 'lib/moesif_api/models/campaign_model.rb', line 11 def utm_medium @utm_medium end |
#utm_source ⇒ String
the utm source
7 8 9 |
# File 'lib/moesif_api/models/campaign_model.rb', line 7 def utm_source @utm_source end |
#utm_term ⇒ String
the utm term
19 20 21 |
# File 'lib/moesif_api/models/campaign_model.rb', line 19 def utm_term @utm_term end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/moesif_api/models/campaign_model.rb', line 72 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash utm_source = hash["utm_source"] utm_medium = hash["utm_medium"] utm_campaign = hash["utm_campaign"] utm_term = hash["utm_term"] utm_content = hash["utm_content"] referrer = hash["referrer"] referring_domain = hash["referring_domain"] gclid = hash["gclid"] # Create object from extracted values CampaignModel.new(utm_source, utm_medium, utm_campaign, utm_term, utm_content, referrer, referring_domain, gclid) end end |
.names ⇒ Object
A mapping from model property names to API property names
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/moesif_api/models/campaign_model.rb', line 38 def self.names if @hash.nil? @hash = {} @hash["utm_source"] = "utm_source" @hash["utm_medium"] = "utm_medium" @hash["utm_campaign"] = "utm_campaign" @hash["utm_term"] = "utm_term" @hash["utm_content"] = "utm_content" @hash["referrer"] = "referrer" @hash["referring_domain"] = "referring_domain" @hash["gclid"] = "gclid" end @hash end |