Class: GoogleApi::Ga::Segment

Inherits:
Management show all
Defined in:
lib/google_api/ga/management/segment.rb

Instance Attribute Summary collapse

Attributes inherited from Management

#created, #id, #name, #updated

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Management

#camelize

Constructor Details

#initialize(segment) ⇒ Segment

Returns a new instance of Segment.



8
9
10
# File 'lib/google_api/ga/management/segment.rb', line 8

def initialize(segment)
  set(segment)
end

Instance Attribute Details

#definitionObject

Returns the value of attribute definition.



6
7
8
# File 'lib/google_api/ga/management/segment.rb', line 6

def definition
  @definition
end

#segment_idObject

Returns the value of attribute segment_id.



5
6
7
# File 'lib/google_api/ga/management/segment.rb', line 5

def segment_id
  @segment_id
end

Class Method Details

.all(segment_id = '~all') ⇒ Object



12
13
14
# File 'lib/google_api/ga/management/segment.rb', line 12

def self.all(segment_id = '~all')
  get({ segmentId: segment_id }).map { |segment| Segment.new(segment) }
end

.find(segment_id) ⇒ Object



16
17
18
# File 'lib/google_api/ga/management/segment.rb', line 16

def self.find(segment_id)
  all(segment_id).first
end

Instance Method Details

#refreshObject



20
21
22
23
24
# File 'lib/google_api/ga/management/segment.rb', line 20

def refresh
  set( Segment.get({ segmentId: @id }).first )

  return true
end