Class: ActionNetworkRest::AdvocacyCampaigns

Inherits:
Base
  • Object
show all
Defined in:
lib/action_network_rest/advocacy_campaigns.rb

Instance Method Summary collapse

Methods inherited from Base

#all, #get, #list

Constructor Details

#initialize(client:) ⇒ AdvocacyCampaigns

Returns a new instance of AdvocacyCampaigns.



5
6
7
# File 'lib/action_network_rest/advocacy_campaigns.rb', line 5

def initialize(client:)
  super(client: client)
end

Instance Method Details

#base_pathObject



9
10
11
# File 'lib/action_network_rest/advocacy_campaigns.rb', line 9

def base_path
  'advocacy_campaigns/'
end

#create(advocacy_campaign_data) ⇒ Object



13
14
15
16
17
18
# File 'lib/action_network_rest/advocacy_campaigns.rb', line 13

def create(advocacy_campaign_data)
  post_body = advocacy_campaign_data
  puts base_path
  response = client.post_request(base_path, post_body)
  object_from_response(response, action_network_id_required: true)
end

#update(advocacy_campaign_id, advocacy_campaign_data) ⇒ Object



20
21
22
23
24
25
# File 'lib/action_network_rest/advocacy_campaigns.rb', line 20

def update(advocacy_campaign_id, advocacy_campaign_data)
  put_body = advocacy_campaign_data

  response = client.put_request("#{base_path}#{advocacy_campaign_id}", put_body)
  object_from_response(response, action_network_id_required: true)
end