Class: Hisui::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/hisui/response.rb,
lib/hisui/response/ga_data.rb

Defined Under Namespace

Classes: GaData

Instance Method Summary collapse

Constructor Details

#initialize(response:, request:) ⇒ Response

Returns a new instance of Response.



3
4
5
# File 'lib/hisui/response.rb', line 3

def initialize(response:, request:)
  @ga_data = GaData.new(response: response, request: request)
end

Instance Method Details

#comparingObject



16
17
18
# File 'lib/hisui/response.rb', line 16

def comparing
  @comparing ||= @ga_data.construct(:second)
end

#comparing_totalObject



33
34
35
# File 'lib/hisui/response.rb', line 33

def comparing_total
  @comparing_total ||= @ga_data.sum(:second)
end

#data?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/hisui/response.rb', line 37

def data?
  @ga_data.data?
end

#primaryObject



12
13
14
# File 'lib/hisui/response.rb', line 12

def primary
  @primary ||= @ga_data.construct(:first)
end

#primary_totalObject



29
30
31
# File 'lib/hisui/response.rb', line 29

def primary_total
  @primary_total ||= @ga_data.sum(:first)
end

#raw_attributesObject



7
8
9
10
# File 'lib/hisui/response.rb', line 7

def raw_attributes
  warn "[DEPRECATION] `raw_attributes` is deprecated. Please use `primary` instead."
  primary
end

#rowsObject



20
21
22
# File 'lib/hisui/response.rb', line 20

def rows
  @rows ||= @ga_data.rows
end

#total_valuesObject



24
25
26
27
# File 'lib/hisui/response.rb', line 24

def total_values
  warn "[DEPRECATION] `total_values` is deprecated. Please use `primary_total` instead."
  primary_total
end