Module: CTAAggregatorClient::CTAResource

Included in:
AdvocacyCampaign, Event, Location, Target
Defined in:
lib/cta_aggregator_client/cta_resource.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cta_aggregator_client/cta_resource.rb', line 14

def create(attributes)
  if relationships
    relationship_data = { relationships => attributes.delete(relationships) }
  end

  API::Client.create(resource_name, attributes, relationship_data)
end

#delete(uuid) ⇒ Object



27
28
29
# File 'lib/cta_aggregator_client/cta_resource.rb', line 27

def delete(uuid)
  API::Client.delete(resource_name, uuid)
end

#find(uuid) ⇒ Object



10
11
12
# File 'lib/cta_aggregator_client/cta_resource.rb', line 10

def find(uuid)
  API::Client.find(resource_name, uuid)
end

#list(filters = {}) ⇒ Object



6
7
8
# File 'lib/cta_aggregator_client/cta_resource.rb', line 6

def list(filters = {})
  API::Client.list(resource_name, filters)
end

#relationshipsObject



35
36
37
# File 'lib/cta_aggregator_client/cta_resource.rb', line 35

def relationships
  nil
end

#resource_nameObject

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/cta_aggregator_client/cta_resource.rb', line 31

def resource_name
  raise NotImplementedError
end

#update(attributes) ⇒ Object



22
23
24
25
# File 'lib/cta_aggregator_client/cta_resource.rb', line 22

def update(attributes)
  uuid = attributes.delete(:id)
  API::Client.update(resource_name, uuid, attributes)
end