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

#get, #list

Instance Attribute Details

#tag_idObject

Returns the value of attribute tag_id.



3
4
5
# File 'lib/action_network_rest/taggings.rb', line 3

def tag_id
  @tag_id
end

Instance Method Details

#base_pathObject



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

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

#create(tagging_data, person_id:) ⇒ Object



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

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



18
19
20
21
# File 'lib/action_network_rest/taggings.rb', line 18

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