Class: QualtricsAPI::PanelCollection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, Extensions::SerializableCollection
Defined in:
lib/qualtrics_api/panel_collection.rb

Instance Method Summary collapse

Methods included from Extensions::SerializableCollection

#as_json, #to_json

Instance Method Details

#[](panel_id) ⇒ Object



19
20
21
# File 'lib/qualtrics_api/panel_collection.rb', line 19

def [](panel_id)
  find(panel_id)
end

#fetch(_options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/qualtrics_api/panel_collection.rb', line 13

def fetch(_options = {})
  @all = []
  parse_fetch_response(QualtricsAPI.connection.get('panels'))
  self
end

#find(panel_id) ⇒ Object



23
24
25
26
27
# File 'lib/qualtrics_api/panel_collection.rb', line 23

def find(panel_id)
  @all.detect do |panel|
    panel.id == panel_id
  end || QualtricsAPI::Panel.new("panelId" => panel_id)
end