Class: WufooParty::Report

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

Overview

Wraps an individual Wufoo Report.

Instantiation

There are two ways to instantiate a Report object:

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

  2. Via the WufooParty::Report class directly.

wufoo = WufooParty.new(ACCOUNT, API_KEY)
report = wufoo.report(REPORT_ID)
# or...
report = WufooParty::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

Instance Method Summary collapse

Methods inherited from Entity

#initialize

Constructor Details

This class inherits a constructor from WufooParty::Entity

Instance Method Details

#[](id) ⇒ Object

Access report details.



313
314
315
316
# File 'lib/wufoo_party.rb', line 313

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

#fieldsObject

Returns field details for the report



319
320
321
# File 'lib/wufoo_party.rb', line 319

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

#widgetsObject

Returns widget details for the report



324
325
326
# File 'lib/wufoo_party.rb', line 324

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