Module: KindridClient::Tag

Included in:
Client
Defined in:
lib/kindrid_client/client/tag.rb

Defined Under Namespace

Modules: Extensions

Instance Method Summary collapse

Instance Method Details

#tags(donor_id, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kindrid_client/client/tag.rb', line 16

def tags(donor_id, options={})
  params = {}
  params.merge!(options)

  # clear empty key/value pairs
  params.reject! { |key, value| value.nil? }

  # add donor_id to results and allow put and delete methods
  get("donors/#{donor_id}/tags", params).tap { |response| 
    response.class.instance_eval do
      define_method(:donor_id) do
        response..resultset.donorID
      end
    end
  }.results.extend(Extensions)
end