Class: ActionKitApi::Event

Inherits:
ApiDataModel show all
Includes:
Searchable
Defined in:
lib/action_kit_api/event.rb

Instance Attribute Summary collapse

Attributes inherited from ApiDataModel

#created_at, #updated_at

Instance Method Summary collapse

Methods included from Searchable

included

Methods inherited from ApiDataModel

#safe_hash, #save, #to_hash, #update, #valid?

Constructor Details

#initialize(*args) ⇒ Event

Returns a new instance of Event.



19
20
21
22
23
24
# File 'lib/action_kit_api/event.rb', line 19

def initialize(*args)
  @required_attrs = [:campaign_id, :creator_id]
  @read_only_attrs = [:attendee_count, :host_is_confirmed, :is_full, :is_in_past, :is_open_for_signup, :status_summary]

  super
end

Instance Attribute Details

#address1Object

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def address1
  @address1
end

#address2Object

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def address2
  @address2
end

#attendee_countObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def attendee_count
  @attendee_count
end

#campaign_idObject

Required



8
9
10
# File 'lib/action_kit_api/event.rb', line 8

def campaign_id
  @campaign_id
end

#cityObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def city
  @city
end

#countryObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def country
  @country
end

#creator_idObject

Required



8
9
10
# File 'lib/action_kit_api/event.rb', line 8

def creator_id
  @creator_id
end

#directionsObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def directions
  @directions
end

#ends_atObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def ends_at
  @ends_at
end

#host_is_confirmedObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def host_is_confirmed
  @host_is_confirmed
end

#idObject

Required



8
9
10
# File 'lib/action_kit_api/event.rb', line 8

def id
  @id
end

#is_approvedObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def is_approved
  @is_approved
end

#is_fullObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def is_full
  @is_full
end

#is_in_pastObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def is_in_past
  @is_in_past
end

#is_open_for_signupObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def 
  @is_open_for_signup
end

#is_privateObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def is_private
  @is_private
end

#latitudeObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def latitude
  @latitude
end

#longitudeObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def longitude
  @longitude
end

#max_attendeesObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def max_attendees
  @max_attendees
end

#note_to_attendeesObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def note_to_attendees
  @note_to_attendees
end

#notesObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def notes
  @notes
end

#phoneObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def phone
  @phone
end

#plus4Object

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def plus4
  @plus4
end

#postalObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def postal
  @postal
end

#public_descriptionObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def public_description
  @public_description
end

#regionObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def region
  @region
end

#starts_atObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def starts_at
  @starts_at
end

#stateObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def state
  @state
end

#statusObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def status
  @status
end

#status_summaryObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def status_summary
  @status_summary
end

#titleObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def title
  @title
end

#venueObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def venue
  @venue
end

#zipObject

Other/Active



11
12
13
# File 'lib/action_kit_api/event.rb', line 11

def zip
  @zip
end

Instance Method Details

#cancelObject



41
42
43
44
45
46
# File 'lib/action_kit_api/event.rb', line 41

def cancel
  raise "Can't cancel to uncreated Event, please save" if self.id.nil?

  self.status = "cancelled"
  self.save
end

#signup(user) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/action_kit_api/event.rb', line 26

def (user)
  raise "Can't signup to uncreated Event, please save" if self.id.nil?

  event_campaign = ActionKitApi::EventCampaign.find_by_id(self.campaign_id)

  action_attrs = {
    :event_id => self.id,
    :event_signup_ground_rules => 1,
    :akid => user.akid,
    :page => "#{event_campaign.name}_attend"
  }

  ActionKitApi.raw_act(action_attrs)
end