New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bps-google-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bps-google-api

0.7.0
Rubygems
Version published
Maintainers
1
Created
Source

BPS Google API

Gem Version Build Status

A configured Google API wrapper.

Installation

Add this to your Gemfile:

gem 'bps-google-api'

or install directly:

gem install bps-google-api

Configure the root directories for the gem:

GoogleAPI.configure do |config|
  config.root = File.join('tmp', 'google_api')
end

For Rails, create an initializer:

GoogleAPI.configure do |config|
  config.root = Rails.root.join('config', 'google_api')
  config.keys = Rails.root.join('config', 'keys')
end

You can also alter the logging level using:

GoogleAPI.logging!(:FATAL) # %i[INFO WARN ERROR FATAL]

Then add the following in config/application.rb:

require 'google_api'

Required Environment

GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET

GOOGLE_ACCESS_TOKEN
GOOGLE_REFRESH_TOKEN
GOOGLE_AUTH_EXP

GOOGLE_CALENDAR_ID_TEST

TZ # Timezone

Usage

By default, if no configuration is available, .new will automatically run .authorize! and return a URL to generate an authorization token.

Configured Classes

There are configured classes for both calendars and groups. This allows you to only specify the parent id once.

calendar = GoogleAPI::Configured::Calendar.new(calendar_id)

calendar.create(event_options)
calendar.list(max_results: 2500, page_token: nil)
calendar.list_all
calendar.get(event_id)
calendar.patch(event_id, patch_options)
calendar.update(event_id, updated_event_options)
calendar.add_conference(event_id)
calendar.conference_info(event_id, all: false)
calendar.delete(event_id)

calendar.permit(user)
calendar.unpermit(user)
group = GoogleAPI::Configured::Group.new('group@example.com')

group.get
group.members
group.add('somebody@example.com')
group.remove('somebody@example.com')

There is also an event-specific configured class:

event = GoogleAPI::Configured::Calendar::Event.new(calendar_id, event_id)

event.get
event.patch(patch_options)
event.update(updated_event_options)
event.add_conference
event.conference_info(all: false)
event.delete

Event Options

Available event options are listed in GoogleAPI::Calendar::VALID_EVENT_KEYS.

repeat_pattern = 'WEEKLY' # 'DAILY', etc.
recurrence = ["RRULE:FREQ=#{repeat_pattern};COUNT=#{sessions}"]

event_options = {
  start: start_date, end: end_date, recurrence: recurrence,
  summary: event_title, description: event_description,
  location: location
}

To add a Meet call to an event, merge the following into event_options:

{ conference: { id: meeting_id, signature: meeting_signature } }

To create a new Meet call on an event, merge the following into event_options instead:

{ conference: { id: :new } }

Testing

Rspec

Rspec testing is available:

bundle exec rspec

The spec suite will fail if under 100% coverage.

Rubocop

Rubocop formatting validation is available:

bundle exec rubocop

Automatic Builds

Builds are generated automatically by Travis CI.

Build success requires both rspec and rubocop to pass.

FAQs

Package last updated on 18 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts