Class: EventBright::Event
- Inherits:
-
ApiObject
show all
- Defined in:
- lib/eventbright/api_objects/event.rb,
lib/eventbright/api_objects/organizer.rb
Instance Attribute Summary collapse
Attributes inherited from ApiObject
#attributes, #collections, #dirty, #dirty_collections, #dirty_relations, #id, #owner, #relations
Instance Method Summary
collapse
Methods inherited from ApiObject
#after_attribute_set, #after_load, #after_save, #after_update, #api_hash, #attribute_get, #attribute_set, #before_save, #clean!, #dirty?, #get_hash, #init, #init_with_hash, #initialize, #inspect, #load, #load!, #loaded?, #new_hash, #preinit, #prep_api_hash, #save, #to_s, #updatable_hash, #update_hash
#collection, #collections, #has, #ignores, #plural_name, #readable, #readable_date, #reformats, #relations, #remap, #renames, #requires, #singlet_name, #updatable, #updatable_date
#collection_clean!, #collection_dirty!, #collection_dirty?, #collection_get, #collection_set, #collections_save, #load_collections_with_hash, #load_relations_with_hash, #relation_clean!, #relation_dirty!, #relation_dirty?, #relation_get, #relation_set, #relations_save
Instance Attribute Details
#organizer ⇒ Object
Returns the value of attribute organizer.
26
27
28
|
# File 'lib/eventbright/api_objects/event.rb', line 26
def organizer
@organizer
end
|
#venue ⇒ Object
Returns the value of attribute venue.
26
27
28
|
# File 'lib/eventbright/api_objects/event.rb', line 26
def venue
@venue
end
|
Instance Method Details
#after_new ⇒ Object
69
70
71
|
# File 'lib/eventbright/api_objects/event.rb', line 69
def after_new
@owner.dirty_events!
end
|
#currency ⇒ Object
44
45
46
|
# File 'lib/eventbright/api_objects/event.rb', line 44
def currency
attribute_get(:currency) || attribute_set(:currency, "USD")
end
|
#nested_hash ⇒ Object
73
74
75
|
# File 'lib/eventbright/api_objects/event.rb', line 73
def nested_hash
{:id => id, :count => 99999, :user => owner} end
|
#privacy ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/eventbright/api_objects/event.rb', line 34
def privacy
case attribute_get(:privacy)
when "Private"
attribute_set(:privacy, 0)
when "Public"
attribute_set(:privacy, 1)
end
attribute_get(:privacy)
end
|
#private? ⇒ Boolean
57
58
59
|
# File 'lib/eventbright/api_objects/event.rb', line 57
def private?
privacy == 0 ? true : false
end
|
#public? ⇒ Boolean
61
62
63
|
# File 'lib/eventbright/api_objects/event.rb', line 61
def public?
!private?
end
|
#timezone ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/eventbright/api_objects/event.rb', line 48
def timezone
return attribute_get(:timezone) if attribute_get(:timezone) =~ /GMT[+-]\d{1,2}/
time = TZInfo::Timezone.get(attribute_get(:timezone)).current_period
seconds = time.utc_offset
offset = (seconds / (60*60))
attribute_set(:timezone, (offset < 0 ? "GMT#{offset}" : "GMT+#{offset}"))
attribute_get(:timezone)
end
|
#unnest_child_response(response) ⇒ Object
65
66
67
|
# File 'lib/eventbright/api_objects/event.rb', line 65
def unnest_child_response(response)
response.has_key?('event') ? response['event'] : response
end
|