Module: Sem4r::ReportDefinitionAccountExtension
- Included in:
- Account
- Defined in:
- lib/sem4r/report_definition/report_definition_account_extension.rb
Instance Method Summary collapse
-
#p_report_definitions(refresh = false) ⇒ Object
Prints on stdout the list of report definition contained into account.
-
#report_definition { ... } ⇒ ReportDefinition
Create a new report definition.
-
#report_definition_delete(repdef_or_id) ⇒ Object
Delete a report definition.
-
#report_definition_delete_all ⇒ Object
Delete all report definition.
-
#report_definitions(refresh = false) ⇒ Array of ReportDefinition
Returns an array of ReportDefinition.
-
#report_fields(report_type) ⇒ Object
Query the list of field for a report type.
Instance Method Details
#p_report_definitions(refresh = false) ⇒ Object
Prints on stdout the list of report definition contained into account
95 96 97 98 99 100 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 95 def p_report_definitions(refresh = false) report_definitions(refresh).each do |report_definition| puts report_definition.to_s end self end |
#report_definition { ... } ⇒ ReportDefinition
Create a new report definition
86 87 88 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 86 def report_definition(&block) ReportDefinition.new(self, &block) end |
#report_definition_delete(repdef_or_id) ⇒ Object
Delete a report definition
@param[ReportDefinition, Number]
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 47 def report_definition_delete(repdef_or_id) if repdef_or_id.class == ReportDefinition report_definition = repdef_or_id else report_definition = ReportDefinition.new(self) report_definition.instance_eval { @id = repdef_or_id } end op = ReportDefinitionOperation.remove(report_definition) = service.report_definition.mutate(credentials, op.to_xml) add_counters(.counters) unless @report_definitions @report_definition.delete_if { |repdef| repdef == report_definition.id } end report_definition.instance_eval { @id = -1 } # repdef status invalid/deleted self end |
#report_definition_delete_all ⇒ Object
Delete all report definition
69 70 71 72 73 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 69 def report_definition_delete_all report_definitions.each do |repdef| repdef.delete end end |
#report_definitions(refresh = false) ⇒ Array of ReportDefinition
Returns an array of ReportDefinition
107 108 109 110 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 107 def report_definitions(refresh = false) _report_definitions unless @report_definitions and !refresh @report_definitions end |
#report_fields(report_type) ⇒ Object
Query the list of field for a report type
33 34 35 36 37 38 39 40 |
# File 'lib/sem4r/report_definition/report_definition_account_extension.rb', line 33 def report_fields(report_type) = service.report_definition.report_fields(credentials, report_type) add_counters(.counters) els = .response.xpath("//getReportFieldsResponse/rval") els.map do |el| ReportField.from_element(el) end end |