Class: DataDoctorWrapper::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/datadoctorwrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(apikey) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/datadoctorwrapper.rb', line 9

def initialize(apikey)
  @api_key = apikey      
end

Instance Method Details

#push(service, records) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/datadoctorwrapper.rb', line 12

def push service,records
  @array_of_service_with_job_id_hashes_to_return = []
  if AVAILABLE_SERVICES.include? service
    case service
    when 'emailifiedhq'
      collect_in_emailifiedhq_records records
    when 'toolsberry'
      collect_in_toolsberry_records records
    when 'contactplus'
      collect_in_contactplus_records records
    when 'companyplus'
      collect_in_companyplus_records records
    when 'phonester'
      collect_in_phonester_records records
    end
  else
    raise "\nERROR : Invalid Service."
  end
  job_id = send_to service
  return job_id
end

#result(service, jobid) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/datadoctorwrapper.rb', line 42

def result service,jobid
  if AVAILABLE_SERVICES.include? service
    url = SERVICE_URL[service]
    result = get_result url,jobid
    return result
  else
    raise "\nERROR : Invalid Service."
  end
end

#status(service, jobid) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/datadoctorwrapper.rb', line 33

def status service,jobid
  if AVAILABLE_SERVICES.include? service
    url = SERVICE_URL[service]
    status = get_status url,jobid
    return status
  else
    raise "\nERROR : Invalid Service."
  end
end