Class: Posthubify::GmbResource
- Inherits:
-
Object
- Object
- Posthubify::GmbResource
- Defined in:
- lib/posthubify/resources/messaging.rb
Overview
Google Business Profile (D2) — location + review. account_id = the connected GBP account.
Instance Method Summary collapse
- #batch_reviews(account_id, location_names) ⇒ Object
- #complete_verification(account_id, verification_id, pin, location_id: nil) ⇒ Object
- #create_media(account_id, source_url, category, location_id: nil) ⇒ Object
- #create_place_action(account_id, uri, place_action_type, location_id: nil) ⇒ Object
- #delete_media(account_id, media_id, location_id: nil) ⇒ Object
- #delete_place_action(account_id, name, location_id: nil) ⇒ Object
- #delete_review_reply(account_id, review_id, location_id: nil) ⇒ Object
- #fetch_verification_options(account_id, language_code, context: nil, location_id: nil) ⇒ Object
- #get_attributes(account_id, location_id: nil) ⇒ Object
- #get_food_menus(account_id, location_id: nil) ⇒ Object
-
#get_location_details(account_id, location_id: nil, read_mask: nil) ⇒ Object
── Listing content (D2 cp3) ──.
- #get_services(account_id, location_id: nil) ⇒ Object
-
#get_verifications(account_id, location_id: nil) ⇒ Object
── Verification (D2 cp3) ──.
-
#initialize(http) ⇒ GmbResource
constructor
A new instance of GmbResource.
- #list_attribute_metadata(account_id, language_code:, location_id: nil, category_name: nil, region_code: nil, page_size: nil, page_token: nil) ⇒ Object
- #list_locations(account_id, page_token: nil) ⇒ Object
-
#list_media(account_id, location_id: nil, page_size: nil, page_token: nil) ⇒ Object
── Media (D2 cp3) ──.
-
#list_place_actions(account_id, location_id: nil, page_size: nil, page_token: nil) ⇒ Object
── Place actions (D2 cp3) ──.
- #list_reviews(account_id, location_id: nil, page_token: nil) ⇒ Object
- #reply_review(account_id, review_id, comment, location_id: nil) ⇒ Object
- #start_verification(account_id, body, location_id: nil) ⇒ Object
- #switch_location(account_id, location_name) ⇒ Object
- #update_attributes(account_id, attributes, attribute_mask, location_id: nil) ⇒ Object
- #update_food_menus(account_id, menus, update_mask: nil, location_id: nil) ⇒ Object
- #update_location_details(account_id, update_mask, patch, location_id: nil) ⇒ Object
- #update_place_action(account_id, name, uri: nil, place_action_type: nil, location_id: nil) ⇒ Object
- #update_services(account_id, service_items, location_id: nil) ⇒ Object
Constructor Details
#initialize(http) ⇒ GmbResource
Returns a new instance of GmbResource.
643 644 645 |
# File 'lib/posthubify/resources/messaging.rb', line 643 def initialize(http) @http = http end |
Instance Method Details
#batch_reviews(account_id, location_names) ⇒ Object
660 661 662 663 |
# File 'lib/posthubify/resources/messaging.rb', line 660 def batch_reviews(account_id, location_names) @http.data('POST', "/accounts/#{account_id}/gmb-reviews/batch", body: { 'locationNames' => location_names }) end |
#complete_verification(account_id, verification_id, pin, location_id: nil) ⇒ Object
780 781 782 783 |
# File 'lib/posthubify/resources/messaging.rb', line 780 def complete_verification(account_id, verification_id, pin, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-verifications/#{verification_id}/complete", body: { 'pin' => pin }, query: { 'locationId' => location_id }) end |
#create_media(account_id, source_url, category, location_id: nil) ⇒ Object
730 731 732 733 734 |
# File 'lib/posthubify/resources/messaging.rb', line 730 def create_media(account_id, source_url, category, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-media", body: { 'sourceUrl' => source_url, 'category' => category }, query: { 'locationId' => location_id }) end |
#create_place_action(account_id, uri, place_action_type, location_id: nil) ⇒ Object
747 748 749 750 751 |
# File 'lib/posthubify/resources/messaging.rb', line 747 def create_place_action(account_id, uri, place_action_type, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-place-actions", body: { 'uri' => uri, 'placeActionType' => place_action_type }, query: { 'locationId' => location_id }) end |
#delete_media(account_id, media_id, location_id: nil) ⇒ Object
736 737 738 739 |
# File 'lib/posthubify/resources/messaging.rb', line 736 def delete_media(account_id, media_id, location_id: nil) @http.data('DELETE', "/accounts/#{account_id}/gmb-media", query: { 'mediaId' => media_id, 'locationId' => location_id }) end |
#delete_place_action(account_id, name, location_id: nil) ⇒ Object
759 760 761 762 |
# File 'lib/posthubify/resources/messaging.rb', line 759 def delete_place_action(account_id, name, location_id: nil) @http.data('DELETE', "/accounts/#{account_id}/gmb-place-actions", query: { 'name' => name, 'locationId' => location_id }) end |
#delete_review_reply(account_id, review_id, location_id: nil) ⇒ Object
670 671 672 673 |
# File 'lib/posthubify/resources/messaging.rb', line 670 def delete_review_reply(account_id, review_id, location_id: nil) @http.data('DELETE', "/accounts/#{account_id}/gmb-reviews/#{review_id}/reply", query: { 'locationId' => location_id }) end |
#fetch_verification_options(account_id, language_code, context: nil, location_id: nil) ⇒ Object
774 775 776 777 778 |
# File 'lib/posthubify/resources/messaging.rb', line 774 def (account_id, language_code, context: nil, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-verifications/options", body: { 'languageCode' => language_code, 'context' => context }, query: { 'locationId' => location_id }) end |
#get_attributes(account_id, location_id: nil) ⇒ Object
687 688 689 |
# File 'lib/posthubify/resources/messaging.rb', line 687 def get_attributes(account_id, location_id: nil) @http.data('GET', "/accounts/#{account_id}/gmb-attributes", query: { 'locationId' => location_id }) end |
#get_food_menus(account_id, location_id: nil) ⇒ Object
714 715 716 |
# File 'lib/posthubify/resources/messaging.rb', line 714 def (account_id, location_id: nil) @http.data('GET', "/accounts/#{account_id}/gmb-food-menus", query: { 'locationId' => location_id }) end |
#get_location_details(account_id, location_id: nil, read_mask: nil) ⇒ Object
── Listing content (D2 cp3) ──
676 677 678 679 |
# File 'lib/posthubify/resources/messaging.rb', line 676 def get_location_details(account_id, location_id: nil, read_mask: nil) @http.data('GET', "/accounts/#{account_id}/gmb-location-details", query: { 'locationId' => location_id, 'readMask' => read_mask }) end |
#get_services(account_id, location_id: nil) ⇒ Object
705 706 707 |
# File 'lib/posthubify/resources/messaging.rb', line 705 def get_services(account_id, location_id: nil) @http.data('GET', "/accounts/#{account_id}/gmb-services", query: { 'locationId' => location_id }) end |
#get_verifications(account_id, location_id: nil) ⇒ Object
── Verification (D2 cp3) ──
765 766 767 |
# File 'lib/posthubify/resources/messaging.rb', line 765 def get_verifications(account_id, location_id: nil) @http.data('GET', "/accounts/#{account_id}/gmb-verifications", query: { 'locationId' => location_id }) end |
#list_attribute_metadata(account_id, language_code:, location_id: nil, category_name: nil, region_code: nil, page_size: nil, page_token: nil) ⇒ Object
697 698 699 700 701 702 703 |
# File 'lib/posthubify/resources/messaging.rb', line 697 def (account_id, language_code:, location_id: nil, category_name: nil, region_code: nil, page_size: nil, page_token: nil) @http.data('GET', "/accounts/#{account_id}/gmb-attribute-metadata", query: { 'languageCode' => language_code, 'locationId' => location_id, 'categoryName' => category_name, 'regionCode' => region_code, 'pageSize' => page_size, 'pageToken' => page_token }) end |
#list_locations(account_id, page_token: nil) ⇒ Object
647 648 649 |
# File 'lib/posthubify/resources/messaging.rb', line 647 def list_locations(account_id, page_token: nil) @http.data('GET', "/accounts/#{account_id}/gmb-locations", query: { 'pageToken' => page_token }) end |
#list_media(account_id, location_id: nil, page_size: nil, page_token: nil) ⇒ Object
── Media (D2 cp3) ──
725 726 727 728 |
# File 'lib/posthubify/resources/messaging.rb', line 725 def list_media(account_id, location_id: nil, page_size: nil, page_token: nil) @http.data('GET', "/accounts/#{account_id}/gmb-media", query: { 'locationId' => location_id, 'pageSize' => page_size, 'pageToken' => page_token }) end |
#list_place_actions(account_id, location_id: nil, page_size: nil, page_token: nil) ⇒ Object
── Place actions (D2 cp3) ──
742 743 744 745 |
# File 'lib/posthubify/resources/messaging.rb', line 742 def list_place_actions(account_id, location_id: nil, page_size: nil, page_token: nil) @http.data('GET', "/accounts/#{account_id}/gmb-place-actions", query: { 'locationId' => location_id, 'pageSize' => page_size, 'pageToken' => page_token }) end |
#list_reviews(account_id, location_id: nil, page_token: nil) ⇒ Object
655 656 657 658 |
# File 'lib/posthubify/resources/messaging.rb', line 655 def list_reviews(account_id, location_id: nil, page_token: nil) @http.data('GET', "/accounts/#{account_id}/gmb-reviews", query: { 'locationId' => location_id, 'pageToken' => page_token }) end |
#reply_review(account_id, review_id, comment, location_id: nil) ⇒ Object
665 666 667 668 |
# File 'lib/posthubify/resources/messaging.rb', line 665 def reply_review(account_id, review_id, comment, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-reviews/#{review_id}/reply", body: { 'comment' => comment }, query: { 'locationId' => location_id }) end |
#start_verification(account_id, body, location_id: nil) ⇒ Object
769 770 771 772 |
# File 'lib/posthubify/resources/messaging.rb', line 769 def start_verification(account_id, body, location_id: nil) @http.data('POST', "/accounts/#{account_id}/gmb-verifications", body: body, query: { 'locationId' => location_id }) end |
#switch_location(account_id, location_name) ⇒ Object
651 652 653 |
# File 'lib/posthubify/resources/messaging.rb', line 651 def switch_location(account_id, location_name) @http.data('PUT', "/accounts/#{account_id}/gmb-locations", body: { 'locationName' => location_name }) end |
#update_attributes(account_id, attributes, attribute_mask, location_id: nil) ⇒ Object
691 692 693 694 695 |
# File 'lib/posthubify/resources/messaging.rb', line 691 def update_attributes(account_id, attributes, attribute_mask, location_id: nil) @http.data('PUT', "/accounts/#{account_id}/gmb-attributes", body: { 'attributes' => attributes, 'attributeMask' => attribute_mask }, query: { 'locationId' => location_id }) end |
#update_food_menus(account_id, menus, update_mask: nil, location_id: nil) ⇒ Object
718 719 720 721 722 |
# File 'lib/posthubify/resources/messaging.rb', line 718 def (account_id, , update_mask: nil, location_id: nil) @http.data('PUT', "/accounts/#{account_id}/gmb-food-menus", body: { 'menus' => , 'updateMask' => update_mask }, query: { 'locationId' => location_id }) end |
#update_location_details(account_id, update_mask, patch, location_id: nil) ⇒ Object
681 682 683 684 685 |
# File 'lib/posthubify/resources/messaging.rb', line 681 def update_location_details(account_id, update_mask, patch, location_id: nil) @http.data('PUT', "/accounts/#{account_id}/gmb-location-details", body: { 'updateMask' => update_mask, 'patch' => patch }, query: { 'locationId' => location_id }) end |
#update_place_action(account_id, name, uri: nil, place_action_type: nil, location_id: nil) ⇒ Object
753 754 755 756 757 |
# File 'lib/posthubify/resources/messaging.rb', line 753 def update_place_action(account_id, name, uri: nil, place_action_type: nil, location_id: nil) @http.data('PATCH', "/accounts/#{account_id}/gmb-place-actions", body: { 'name' => name, 'uri' => uri, 'placeActionType' => place_action_type }, query: { 'locationId' => location_id }) end |
#update_services(account_id, service_items, location_id: nil) ⇒ Object
709 710 711 712 |
# File 'lib/posthubify/resources/messaging.rb', line 709 def update_services(account_id, service_items, location_id: nil) @http.data('PUT', "/accounts/#{account_id}/gmb-services", body: { 'serviceItems' => service_items }, query: { 'locationId' => location_id }) end |