Class: ActionNetworkRest::Taggings

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#all, #get, #list

Instance Attribute Details

#tag_idObject

Returns the value of attribute tag_id.



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

def tag_id
  @tag_id
end

Instance Method Details

#base_pathObject



7
8
9
# File 'lib/action_network_rest/taggings.rb', line 7

def base_path
  "tags/#{url_escape(tag_id)}/taggings/"
end

#create(tagging_data, person_id:) ⇒ Object



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

def create(tagging_data, person_id:)
  post_body = tagging_data
  person_url = action_network_url("/people/#{url_escape(person_id)}")
  post_body['_links'] = { 'osdi:person' => { href: person_url } }

  response = client.post_request base_path, post_body
  object_from_response(response)
end

#delete(id) ⇒ Object



20
21
22
23
# File 'lib/action_network_rest/taggings.rb', line 20

def delete(id)
  response = client.delete_request "#{base_path}#{url_escape(id)}"
  object_from_response(response)
end