Class: Readiness::GoogleCalendar::Client
- Inherits:
-
Object
- Object
- Readiness::GoogleCalendar::Client
- Defined in:
- lib/support_readiness/google_calendar/client.rb
Overview
Defines the class Client within the module Readiness::GoogleCalendar.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#generate_service(config) ⇒ Object
Generates a service connection to Google Calendar.
-
#initialize(config = Readiness::GoogleCalendar::Configuration.new) ⇒ Client
constructor
Creates a new Client instance.
Constructor Details
#initialize(config = Readiness::GoogleCalendar::Configuration.new) ⇒ Client
Creates a new Readiness::GoogleCalendar::Client instance
30 31 32 33 |
# File 'lib/support_readiness/google_calendar/client.rb', line 30 def initialize(config = Readiness::GoogleCalendar::Configuration.new) @service = generate_service(config) @calendar_id = config.calendar_id end |
Instance Attribute Details
#calendar_id ⇒ Object
14 15 16 |
# File 'lib/support_readiness/google_calendar/client.rb', line 14 def calendar_id @calendar_id end |
#service ⇒ Object
14 15 16 |
# File 'lib/support_readiness/google_calendar/client.rb', line 14 def service @service end |
Instance Method Details
#generate_service(config) ⇒ Object
Generates a service connection to Google Calendar
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/support_readiness/google_calendar/client.rb', line 47 def generate_service(config) = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open(config.filepath), scope: config.scope ) .fetch_access_token! service = Google::Apis::CalendarV3::CalendarService.new service. = service end |