Class: GoogleApiIndexV3Service

Inherits:
ApplicationService show all
Defined in:
app/services/google_api_index_v3_service.rb

Instance Attribute Summary collapse

Attributes inherited from ApplicationService

#object

Instance Method Summary collapse

Methods inherited from ApplicationService

#execute, #execute!

Constructor Details

#initialize(domain) ⇒ GoogleApiIndexV3Service

Returns a new instance of GoogleApiIndexV3Service.



7
8
9
10
11
12
13
14
15
16
# File 'app/services/google_api_index_v3_service.rb', line 7

def initialize(domain)
  @domain = domain
  service = Google::Apis::IndexingV3::IndexingService.new
  authorization = Google::Auth::ServiceAccountCredentials.make_creds(
        json_key_io: File.open('google_api_service_account_credentials.json'),
        scope: 'https://www.googleapis.com/auth/indexing'
    )
  service.authorization = authorization
  @service = service
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



5
6
7
# File 'app/services/google_api_index_v3_service.rb', line 5

def domain
  @domain
end

#serviceObject

Returns the value of attribute service.



4
5
6
# File 'app/services/google_api_index_v3_service.rb', line 4

def service
  @service
end

Instance Method Details

#get_url_notificationObject



18
19
20
# File 'app/services/google_api_index_v3_service.rb', line 18

def get_url_notification
  service.(url: domain.to_s)
end