Module: Hisui::Model
- Defined in:
- lib/hisui/model.rb
Instance Method Summary collapse
-
#dimensions(*field) ⇒ ListParameter
Adds dimensions to the class for retrieval from GA.
-
#filters_expression(field = nil) ⇒ Object
Adds filters_expression to the class for retrieval from GA.
-
#metrics(*field) ⇒ ListParameter
Adds metrics to the class for retrieval from GA.
-
#order_bys(field = nil) ⇒ Object
Adds order_bys to the class for retrieval from GA.
- #results(profile:, **options) ⇒ Object
Instance Method Details
#dimensions(*field) ⇒ ListParameter
Adds dimensions to the class for retrieval from GA
17 18 19 20 21 |
# File 'lib/hisui/model.rb', line 17 def dimensions(*field) @dimensions ||= Set.new([]) field.try(:each) { |f| @dimensions << { name: Hisui.to_ga_string(f) } } @dimensions end |
#filters_expression(field = nil) ⇒ Object
Adds filters_expression to the class for retrieval from GA
operators are ‘==’, ‘~=’ and so on. cf: developers.google.com/analytics/devguides/reporting/core/v3/reference?hl=ja#filters
47 48 49 50 51 |
# File 'lib/hisui/model.rb', line 47 def filters_expression(field = nil) @filters_expression ||= '' @filters_expression = Hisui::FiltersExpression.new(field).to_param if field @filters_expression end |
#metrics(*field) ⇒ ListParameter
Adds metrics to the class for retrieval from GA
7 8 9 10 11 |
# File 'lib/hisui/model.rb', line 7 def metrics(*field) @metrics ||= Set.new([]) field.try(:each) { |f| @metrics << { expression: Hisui.to_ga_string(f) } } @metrics end |
#order_bys(field = nil) ⇒ Object
Adds order_bys to the class for retrieval from GA
cf. developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet#OrderBy
31 32 33 34 35 |
# File 'lib/hisui/model.rb', line 31 def order_bys(field = nil) @order_bys ||= Set.new([]) @order_bys << field if field @order_bys end |
#results(profile:, **options) ⇒ Object
53 54 55 |
# File 'lib/hisui/model.rb', line 53 def results(profile:, **) Hisui::Request.new(profile: profile, model: self, **).fetch_data end |