Class: Ryext::Models::Location

Inherits:
Object
  • Object
show all
Extended by:
Finder
Includes:
Model
Defined in:
lib/ryext/models/location.rb

Constant Summary collapse

COLLECTION_KEY =
'locations'
YEXT_ATTRIBUTES =
{
  id: 'id',
  customer_id: 'customerId',
  location_name: 'locationName',
  address: 'address',
  address2: 'address2',
  suppress_address: 'suppressAddress',
  display_address: 'displayAddress',
  city: 'city',
  state: 'state',
  zip: 'zip',
  country_code: 'countryCode',
  service_area: 'serviceArea',
  phone: 'phone',
  is_phone_tracked: 'isPhoneTracked',
  local_phone: 'localPhone',
  alternate_phone: 'alternatePhone',
  fax_phone: 'faxPhone',
  mobile_phone: 'mobilePhone',
  toll_free_phone: 'tollFreePhone',
  tty_phone: 'ttyPhone',
  category_ids: 'categoryIds',
  special_offer: 'specialOffer',
  special_offer_url: 'specialOfferUrl',
  website_url: 'websiteUrl',
  display_website_url: 'displayWebsiteUrl',
  reservation_url: 'reservationUrl',
  hours: 'hours',
  additional_hours_text: 'additionalHoursText',
  holiday_hours: 'holidayHours',
  description: 'description',
  closed: 'closed',
  payment_options: 'paymentOptions',
  logo: 'logo',
  photos: 'photos',
  video_urls: 'videoUrls',
  twitter_handle: 'twitterHandle',
  google_cover_photo: 'googleCoverPhoto',
  google_profile_photo: 'googleProfilePhoto',
  google_preferred_photo: 'googlePreferredPhoto',
  google_keywords: 'googleKeywords',
  facebook_page_url: 'facebookPageUrl',
  facebook_cover_photo: 'facebookCoverPhoto',
  facebook_profile_picture: 'facebookProfilePicture',
  year_established: 'yearEstablished',
  display_lat: 'displayLat',
  display_lng: 'displayLng',
  routable_lat: 'routableLat',
  routable_lng: 'routableLng',
  yext_display_lat: 'yextDisplayLat',
  yext_display_lng: 'yextDisplayLng',
  yext_routable_lat: 'yextRoutableLat',
  yext_routable_lng: 'yextRoutableLng',
  emails: 'emails',
  specialties: 'specialties',
  services: 'services',
  brands: 'brands',
  languages: 'languages',
  keywords: 'keywords',
  lists: 'lists',
  list_labels: 'listLabels',
  folder_id: 'folderId',
  label_ids: 'labelIds',
  custom_fields: 'customFields'
}

Class Method Summary collapse

Methods included from Finder

all, base_uri, base_url, collection_from, get, instance_klass

Methods included from Model

#build, included, #initialize, #instance_klass

Class Method Details

.clean_params(params) ⇒ Object



19
20
21
# File 'lib/ryext/models/location.rb', line 19

def self.clean_params(params)
  params.reject { |k| ['customerId', 'locationId'].include? k }
end

.default_path(params) ⇒ Object



8
9
10
11
# File 'lib/ryext/models/location.rb', line 8

def self.default_path(params)
  customer_id = params['customerId']
  path(params) || "/customers/#{customer_id}/locations"
end

.path(params) ⇒ Object



13
14
15
16
17
# File 'lib/ryext/models/location.rb', line 13

def self.path(params)
  customer_id = params['customerId']
  location_id = params['locationId']
  "/customers/#{customer_id}/locations/#{location_id}" unless customer_id.nil? || location_id.nil?
end