class Yext::Api::AdministrativeApi::AddRequest
:administrative_api:
:add_request: :actions: - :action: :index :method: :get :endpoint: https://api.yext.com/v2/accounts/{accountId}/addrequests :path_regex: v2/accounts/[^/]+?/addrequests :default_version: 20161012 :documentation: http://developer.yext.com/docs/administrative-api/#operation/listAddRequests :sandbox_only: false - :action: :show :method: :get :endpoint: https://api.yext.com/v2/accounts/{accountId}/addrequests/{addRequestId} :path_regex: v2/accounts/[^/]+?/addrequests/[^/]+?? :default_version: 20161012 :documentation: http://developer.yext.com/docs/administrative-api/#operation/getAddRequest :sandbox_only: false - :action: :create :method: :post :endpoint: https://api.yext.com/v2/accounts/{accountId}/newlocationaddrequests :path_regex: v2/accounts/\w+/newlocationaddrequests :default_version: 20161012 :documentation: http://developer.yext.com/docs/administrative-api/#operation/createNewLocationAddRequest :sandbox_only: false - :action: :update :method: :post :endpoint: https://api.yext.com/v2/accounts/{accountId}/processaddrequest :path_regex: v2/accounts/\w+/processaddrequest :default_version: 20161012 :documentation: http://developer.yext.com/docs/administrative-api/#operation/createProcessReviewAddRequest :sandbox_only: true - :action: :add_services :method: :post :endpoint: https://api.yext.com/v2/accounts/{accountId}/existinglocationaddrequests :path_regex: v2/accounts/\w+/existinglocationaddrequests :default_version: 20161012 :documentation: http://developer.yext.com/docs/administrative-api/#operation/createExistingLocationAddRequest :sandbox_only: false
Public Class Methods
change_status!(request_id, new_status)
click to toggle source
This is a helper method to try to simplify changing the status of an AddRequest
if you don't have an AddRequest
object.
Some examples of ways to change a status:
Yext::Api::AdministrativeApi::AddRequest.change_status!(request_id, Yext::Api::Enumerations::AddRequestStatus::COMPLETE) Yext::Api::AdministrativeApi::AddRequest.new(id: request_id, status: Yext::Api::Enumerations::AddRequestStatus::COMPLETE).save add_request = Yext::Api::AdministrativeApi::AddRequest.find(request_id) add_request.status = Yext::Api::Enumerations::AddRequestStatus::COMPLETE) add_request.save
# File lib/yext/api/administrative_api/add_request.rb, line 72 def self.change_status!(request_id, new_status) raise InvalidArgument "invalid status" unless Yext::Api::Enumerations::AddRequestStatus.all.include?(new_status) new(id: request_id, status: new_status).save end
Public Instance Methods
locationId()
click to toggle source
helper function to extract the affected location ID based on the locationMode
# File lib/yext/api/administrative_api/add_request.rb, line 53 def locationId if locationMode == Yext::Api::Enumerations::AddRequestLocationMode::NEW newLocationId else existingLocationId end end
save()
click to toggle source
After successfully creating a new add request, the object attributes will be updated/ changed to the values of the created add request.
# File lib/yext/api/administrative_api/add_request.rb, line 107 def save if persisted? change_status else create_new_location end end
Private Instance Methods
change_status()
click to toggle source
# File lib/yext/api/administrative_api/add_request.rb, line 130 def change_status scope. with(Yext::Api::Concerns::AccountChild.with_account_path("processaddrequest")). where(addRequestId: id, status: status). post end
create_new_location()
click to toggle source
# File lib/yext/api/administrative_api/add_request.rb, line 117 def create_new_location scope. with(Yext::Api::Concerns::AccountChild.with_account_path("newlocationaddrequests")). where(attributes.reverse_merge(account_id: Yext::Api.configuration.param_account_id)). post if Yext::Api::AdministrativeApi.last_status.between?(200, 299) self.attributes = Yext::Api::AdministrativeApi.last_data.dup else self end end