Class: Ohmage::Campaign
- Inherits:
-
Object
- Object
- Ohmage::Campaign
- Defined in:
- lib/ohmage/entity/campaign.rb
Instance Attribute Summary collapse
- #authored_by ⇒ String (also: #author) readonly
- #classes ⇒ Array readonly
- #creation_timestamp ⇒ String readonly
- #description ⇒ String readonly
- #icon_url ⇒ String readonly
- #name ⇒ String readonly
- #privacy_state ⇒ String readonly
- #running_state ⇒ String readonly
- #survey_response_count ⇒ Hash readonly
- #urn ⇒ String readonly
- #user_role_campaign ⇒ Hash readonly
- #user_roles ⇒ Array (also: #roles) readonly
- #xml ⇒ String readonly
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Campaign
constructor
A new instance of Campaign.
Constructor Details
#initialize(attrs = {}) ⇒ Campaign
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ohmage/entity/campaign.rb', line 12 def initialize(attrs = {}) @urn = attrs.keys[0].to_s attrs.values[0].each do |k, v| instance_variable_set("@#{k}", v) end begin require 'oga' @xml = Oga.parse_xml(@xml) rescue LoadError # rubocop:disable Lint/HandleExceptions # no op, gem is not required. # and yes, rubocop, I did this on purpose! end end |
Instance Attribute Details
#authored_by ⇒ String (readonly) Also known as:
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def @authored_by end |
#classes ⇒ Array (readonly)
7 8 9 |
# File 'lib/ohmage/entity/campaign.rb', line 7 def classes @classes end |
#creation_timestamp ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def @creation_timestamp end |
#description ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def description @description end |
#icon_url ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def icon_url @icon_url end |
#name ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def name @name end |
#privacy_state ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def privacy_state @privacy_state end |
#running_state ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def running_state @running_state end |
#survey_response_count ⇒ Hash (readonly)
10 11 12 |
# File 'lib/ohmage/entity/campaign.rb', line 10 def survey_response_count @survey_response_count end |
#urn ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def urn @urn end |
#user_role_campaign ⇒ Hash (readonly)
10 11 12 |
# File 'lib/ohmage/entity/campaign.rb', line 10 def user_role_campaign @user_role_campaign end |
#user_roles ⇒ Array (readonly) Also known as: roles
7 8 9 |
# File 'lib/ohmage/entity/campaign.rb', line 7 def user_roles @user_roles end |
#xml ⇒ String (readonly)
4 5 6 |
# File 'lib/ohmage/entity/campaign.rb', line 4 def xml @xml end |