Class: GSGraph::AdCampaignStat

Inherits:
Node
  • Object
show all
Defined in:
lib/gs_graph/ad_campaign_stat.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ AdCampaignStat

Returns a new instance of AdCampaignStat.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gs_graph/ad_campaign_stat.rb', line 6

def initialize(identifier, attributes = {})
  super

  %w(campaign_id impressions clicks spent social_impressions social_clicks social_spent actions unique_impressions social_unique_impressions unique_clicks social_unique_clicks connections).each do |field|
    send("#{field}=", attributes[field.to_sym])
  end

  %w(start_time end_time).each do |field|
    if val = attributes[field.to_sym]
      # Handles integer timestamps and ISO8601 strings
      time = Time.parse(val) rescue Time.at(val.to_i)
      send("#{field}=", time)
    end
  end
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def actions
  @actions
end

#campaign_idObject

Returns the value of attribute campaign_id.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def campaign_id
  @campaign_id
end

#clicksObject

Returns the value of attribute clicks.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def clicks
  @clicks
end

#connectionsObject

Returns the value of attribute connections.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def connections
  @connections
end

#end_timeObject

Returns the value of attribute end_time.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def end_time
  @end_time
end

#impressionsObject

Returns the value of attribute impressions.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def impressions
  @impressions
end

#social_clicksObject

Returns the value of attribute social_clicks.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def social_clicks
  @social_clicks
end

#social_impressionsObject

Returns the value of attribute social_impressions.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def social_impressions
  @social_impressions
end

#social_spentObject

Returns the value of attribute social_spent.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def social_spent
  @social_spent
end

#social_unique_clicksObject

Returns the value of attribute social_unique_clicks.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def social_unique_clicks
  @social_unique_clicks
end

#social_unique_impressionsObject

Returns the value of attribute social_unique_impressions.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def social_unique_impressions
  @social_unique_impressions
end

#spentObject

Returns the value of attribute spent.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def spent
  @spent
end

#start_timeObject

Returns the value of attribute start_time.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def start_time
  @start_time
end

#unique_clicksObject

Returns the value of attribute unique_clicks.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def unique_clicks
  @unique_clicks
end

#unique_impressionsObject

Returns the value of attribute unique_impressions.



3
4
5
# File 'lib/gs_graph/ad_campaign_stat.rb', line 3

def unique_impressions
  @unique_impressions
end