class ActionNetworkRest::EventCampaigns

Attributes

event_campaign_id[RW]

Public Class Methods

new(event_campaign_id = nil, client:) click to toggle source

Without a event_campaign_id, this class is used for EventCampaign creation/update endpoints. With a event_campaign_id, this class is used to initialise the Events class, like client.event_campaigns(123).events

Calls superclass method
# File lib/action_network_rest/event_campaigns.rb, line 10
def initialize(event_campaign_id = nil, client:)
  super(client: client, event_campaign_id: event_campaign_id)
end

Public Instance Methods

base_path() click to toggle source
# File lib/action_network_rest/event_campaigns.rb, line 14
def base_path
  'event_campaigns/'
end
create(event_campaign_data) click to toggle source
# File lib/action_network_rest/event_campaigns.rb, line 18
def create(event_campaign_data)
  response = client.post_request(base_path, event_campaign_data)
  object_from_response(response)
end
events(event_id = nil) click to toggle source
# File lib/action_network_rest/event_campaigns.rb, line 29
def events(event_id = nil)
  @_events ||= ActionNetworkRest::Events.new(event_campaign_id: event_campaign_id, event_id: event_id,
                                             client: client)
end
update(id, event_campaign_data) click to toggle source
# File lib/action_network_rest/event_campaigns.rb, line 23
def update(id, event_campaign_data)
  event_campaign_path = "#{base_path}#{url_escape(id)}"
  response = client.put_request event_campaign_path, event_campaign_data
  object_from_response(response)
end

Private Instance Methods

osdi_key() click to toggle source
# File lib/action_network_rest/event_campaigns.rb, line 36
def osdi_key
  'action_network:event_campaigns'
end