Class: Analytics::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/analytics/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, access_token) ⇒ Profile

Returns a new instance of Profile.



5
6
7
8
9
10
11
12
# File 'lib/analytics/profile.rb', line 5

def initialize(opts, access_token)
  @access_token = access_token
  @name = opts.fetch("name")
  @id = opts.fetch("id")
  @url = opts.fetch("websiteUrl")
  @web_property_id = opts.fetch("webPropertyId")
  @account_id = opts.fetch("accountId")
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



19
20
21
# File 'lib/analytics/profile.rb', line 19

def method_missing(method_name, *args, &block)
  report.send(method_name, args, block)
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



3
4
5
# File 'lib/analytics/profile.rb', line 3

def 
  @account_id
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/analytics/profile.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/analytics/profile.rb', line 3

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/analytics/profile.rb', line 3

def url
  @url
end

#web_property_idObject (readonly)

Returns the value of attribute web_property_id.



3
4
5
# File 'lib/analytics/profile.rb', line 3

def web_property_id
  @web_property_id
end

Instance Method Details

#reportObject



14
15
16
# File 'lib/analytics/profile.rb', line 14

def report
  @report ||= Analytics::Report.new(@id, @access_token)
end