Class: Yext::Api::AdministrativeApi::AddRequest
- Inherits:
-
Utils::ApiBase
- Object
- Spyke::Base
- Utils::ApiBase
- Yext::Api::AdministrativeApi::AddRequest
- Includes:
- Concerns::AccountChild
- Defined in:
- lib/yext/api/administrative_api/add_request.rb
Overview
: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
Class Method Summary collapse
-
.change_status!(request_id, new_status) ⇒ Object
This is a helper method to try to simplify changing the status of an AddRequest if you don’t have an AddRequest object.
Instance Method Summary collapse
-
#locationId ⇒ Object
helper function to extract the affected location ID based on the locationMode.
-
#save ⇒ Object
After successfully creating a new add request, the object attributes will be updated/ changed to the values of the created add request.
Methods included from Concerns::AccountChild
#accountId=, association_name, ensure_relation, with_account_path
Methods included from Concerns::FaradayConnection
Class Method Details
.change_status!(request_id, new_status) ⇒ Object
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
72 73 74 75 76 |
# 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 |
Instance Method Details
#locationId ⇒ Object
helper function to extract the affected location ID based on the locationMode
53 54 55 56 57 58 59 |
# 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 ⇒ Object
After successfully creating a new add request, the object attributes will be updated/ changed to the values of the created add request.
107 108 109 110 111 112 113 |
# File 'lib/yext/api/administrative_api/add_request.rb', line 107 def save if persisted? change_status else create_new_location end end |