Class: EngagingNetworks::Supporter

Inherits:
Base
  • Object
show all
Defined in:
lib/engaging_networks/supporter.rb

Instance Method Summary collapse

Methods inherited from Base

#action_path, #data_path, #export_path, #import_path, #scrape

Instance Method Details

#data(email) ⇒ Object



4
5
6
7
8
# File 'lib/engaging_networks/supporter.rb', line 4

def data(email)
  # data.service only returns Y/N values on which fields contain data, not actual data contained
  client.get_request(data_path, {service: 'SupporterData', email: email,
      token_type: EngagingNetworks::Request::MultiTokenAuthentication::PUBLIC, time: Time.now.to_i}) # cache bust the time parameter.
end

#exists?(email) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/engaging_networks/supporter.rb', line 10

def exists?(email)
  return data(email).obj.supporterExists == 'Y'
end

#export(startDate) ⇒ Object



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

def export(startDate)
  # startDate must be MMDDYYY and within last 45 days
  client.get_request(export_path, {startDate: startDate.strftime("%m%d%Y"),
      token_type: EngagingNetworks::Request::MultiTokenAuthentication::PRIVATE})

  # TODO, filter for specific fields
end