class NdsApi::Url

Public Class Methods

new(options = { dev: false }) click to toggle source
# File lib/nds_api/url.rb, line 3
def initialize(options = { dev: false })
  @options = options
  @prod = !@options[:dev]
end

Public Instance Methods

child_by_uid(uid) click to toggle source
# File lib/nds_api/url.rb, line 43
def child_by_uid(uid)
  "#{children}/#{uid}"
end
children() click to toggle source

CHILDREN #####

# File lib/nds_api/url.rb, line 39
def children
  "#{base_url}/children"
end
children_by_client_id(client_id) click to toggle source
# File lib/nds_api/url.rb, line 47
def children_by_client_id(client_id)
  "#{base_url}/clients/#{client_id}/children"
end
client_by_email(email) click to toggle source
# File lib/nds_api/url.rb, line 21
def client_by_email(email)
  "#{client_search}/findByEmail?email=#{email}"
end
client_by_first_name_and_last_name(first_name, last_name) click to toggle source
# File lib/nds_api/url.rb, line 29
def client_by_first_name_and_last_name(first_name, last_name)
  "#{client_search}/findByName?lastName=#{last_name}&firstName=#{first_name}"
end
client_by_id(id) click to toggle source
# File lib/nds_api/url.rb, line 33
def client_by_id(id)
  "#{clients}/#{id}"
end
client_by_phone(phone) click to toggle source
# File lib/nds_api/url.rb, line 25
def client_by_phone(phone)
  "#{client_search}/findByPhone?phone=#{phone}"
end
clients() click to toggle source

CLIENTS #####

# File lib/nds_api/url.rb, line 17
def clients
  "#{base_url}/clients"
end
communities() click to toggle source

COMMUNITIES #####

# File lib/nds_api/url.rb, line 53
def communities
  "#{base_url}/communities?sort=lastModifiedTime,DESC"
end
get_agency_option(type_id = nil) click to toggle source

Agency #####

# File lib/nds_api/url.rb, line 10
def get_agency_option(type_id = nil)
  raise 'NDS API ERROR: Agency Key required' unless @options[:agency_key]
  "#{base_url}/agencies/config/options?agencyKey=#{@options[:agency_key]}#{type_id ? "&typeId=#{type_id}" : ''}"
end
person_by_id(id) click to toggle source
# File lib/nds_api/url.rb, line 63
def person_by_id(id)
  "#{persons}/#{id}"
end
persons() click to toggle source

PERSON #####

# File lib/nds_api/url.rb, line 59
def persons
  "#{base_url}/persons"
end
positions_by_work_email(email) click to toggle source

POSITIONS #####

# File lib/nds_api/url.rb, line 69
def positions_by_work_email(email)
  "#{base_url}/positions/search/findByWorkEmail?workEmail=#{email}"
end
provider_by_id(id) click to toggle source
# File lib/nds_api/url.rb, line 92
def provider_by_id(id)
  "#{base_url}/providers/search/findByProviderId?providerId=#{id}"
end
provider_by_uid(uid) click to toggle source
# File lib/nds_api/url.rb, line 88
def provider_by_uid(uid)
  "#{base_url}/providers/#{uid}"
end
provider_enrollments(uid) click to toggle source
# File lib/nds_api/url.rb, line 117
def provider_enrollments(uid)
  "#{providers}/#{uid}/enrollments"
end
provider_rates(uid) click to toggle source
# File lib/nds_api/url.rb, line 113
def provider_rates(uid)
  "#{providers}/#{uid}/rates"
end
provider_schedule(uid) click to toggle source
# File lib/nds_api/url.rb, line 109
def provider_schedule(uid)
  "#{providers}/#{uid}/schedule"
end
providers() click to toggle source
# File lib/nds_api/url.rb, line 84
def providers
  "#{base_url}/providers"
end
providers_by_center_name(center_name) click to toggle source
# File lib/nds_api/url.rb, line 101
def providers_by_center_name(center_name)
  "#{provider_search}/findByCenterName?centerName=#{center_name}"
end
providers_by_email(email) click to toggle source
# File lib/nds_api/url.rb, line 105
def providers_by_email(email)
  "#{provider_search}/findByEmail?email=#{email}"
end
providers_by_owner_or_center_name(params) click to toggle source
# File lib/nds_api/url.rb, line 96
def providers_by_owner_or_center_name(params)
  params = URI.encode_www_form(params) if params
  "#{provider_search}/findByOwnerOrCenterName#{params ? "?#{params}" : ''}"
end
referral_by_client_id(id) click to toggle source
# File lib/nds_api/url.rb, line 135
def referral_by_client_id(id)
  "#{clients}/#{id}/referrals"
end
referral_by_id(id) click to toggle source
# File lib/nds_api/url.rb, line 131
def referral_by_id(id)
  "#{referrals}/#{id}"
end
referrals() click to toggle source

REFERRALS #####

# File lib/nds_api/url.rb, line 127
def referrals
  "#{base_url}/referrals"
end
referrals_after_date(date) click to toggle source
# File lib/nds_api/url.rb, line 143
def referrals_after_date(date)
  "#{referral_search}/findByDateAfter?date=#{date}"
end
referrals_before_date(date) click to toggle source
# File lib/nds_api/url.rb, line 139
def referrals_before_date(date)
  "#{referral_search}/findByDateBefore?date=#{date}"
end
referrals_in_date_range(start_date, end_date) click to toggle source
# File lib/nds_api/url.rb, line 147
def referrals_in_date_range(start_date, end_date)
  "#{referral_search}/findByDateBetween?startDate=#{start_date}&endDate=#{end_date}"
end
search_providers(params = nil) click to toggle source

PROVIDERS #####

# File lib/nds_api/url.rb, line 75
def search_providers(params = nil)
  params = URI.encode_www_form(params) if params
  "#{providers}/search/findByCriteriaObject#{params ? "?#{params}" : ''}"
end
search_providers_bulk() click to toggle source
# File lib/nds_api/url.rb, line 121
def search_providers_bulk
  "#{providers}/bulk"
end
search_providers_elastic() click to toggle source
# File lib/nds_api/url.rb, line 80
def search_providers_elastic
  "#{providers}/search"
end

Private Instance Methods

base_url() click to toggle source
# File lib/nds_api/url.rb, line 181
def base_url
  if @prod
    'https://api.naccrraware.net'
  else
    'https://api.staging.naccrraware.net'
  end
end
method_missing(method_sym, *arguments, &block) click to toggle source

cover: “create_XXXXXX”, “update_XXXXXX”

Calls superclass method
# File lib/nds_api/url.rb, line 154
def method_missing(method_sym, *arguments, &block)
  create_prefix = 'create_'
  update_prefix = 'update_'

  prefix = create_prefix if method_sym[0..create_prefix.length - 1] == create_prefix
  prefix = update_prefix if method_sym[0..update_prefix.length - 1] == update_prefix

  if method_sym[0..prefix.length - 1] == prefix
    entities = method_sym[prefix.length..method_sym.length]
    send(entities)
  else
    super
  end
end