Class: WuParty::Report

Inherits:
Entity
  • Object
show all
Defined in:
lib/wuparty.rb

Overview

Wraps an individual Wufoo Report.

Instantiation

There are two ways to instantiate a Report object:

  1. Via the parent WuParty object that represents the account.

  2. Via the WuParty::Report class directly.

wufoo = WuParty.new(ACCOUNT, API_KEY)
report = wufoo.report(REPORT_ID)
# or...
report = WuParty::Report.new(REPORT_ID, :account => ACCOUNT, :api_key => API_KEY)

The first technique makes a call to the Wufoo API to get the report details, while the second technique lazily loads the report details, once something is accessed via [].

Report Details

Access report details like it is a Hash, e.g.:

report['Name']

Instance Attribute Summary

Attributes inherited from Entity

#details, #id

Instance Method Summary collapse

Methods inherited from Entity

#initialize

Constructor Details

This class inherits a constructor from WuParty::Entity

Instance Method Details

#[](id) ⇒ Object

Access report details.



397
398
399
400
# File 'lib/wuparty.rb', line 397

def [](id)
  @details ||= @party.report(@id)
  @details[id]
end

#fieldsObject

Returns field details for the report



403
404
405
# File 'lib/wuparty.rb', line 403

def fields
  @party.get("reports/#{@id}/fields")['Fields']
end

#widgetsObject

Returns widget details for the report



408
409
410
# File 'lib/wuparty.rb', line 408

def widgets
  @party.get("reports/#{@id}/widgets")['Widgets']
end