Class: ConstantContact::Components::EventItem

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/event_spot/event_item.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def attributes
  @attributes
end

#default_quantity_availableObject

Returns the value of attribute default_quantity_available



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def default_quantity_available
  @default_quantity_available
end

#default_quantity_totalObject

Returns the value of attribute default_quantity_total



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def default_quantity_total
  @default_quantity_total
end

#descriptionObject

Returns the value of attribute description



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def description
  @description
end

#idObject

Returns the value of attribute id



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def id
  @id
end

#nameObject

Returns the value of attribute name



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def name
  @name
end

#per_registrant_limitObject

Returns the value of attribute per_registrant_limit



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def per_registrant_limit
  @per_registrant_limit
end

#priceObject

Returns the value of attribute price



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def price
  @price
end

#show_quantity_availableObject

Returns the value of attribute show_quantity_available



10
11
12
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 10

def show_quantity_available
  @show_quantity_available
end

Class Method Details

.create(props) ⇒ EventItem

Factory method to create an EventItem object from a hash

Parameters:

  • props (Hash)
    • properties to create object from

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/constantcontact/components/event_spot/event_item.rb', line 16

def self.create(props)
  obj = EventItem.new
  if props
    props.each do |key, value|
      if key == 'attributes'
        if value
          obj.attributes = []
          value.each do |attribute|
            obj.attributes << Components::EventItemAttribute.create(attribute)
          end
        end
      else
        obj.send("#{key}=", value) if obj.respond_to? key
      end
    end
  end
  obj
end