Class: Devcal::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/devcal.rb

Overview

The Client class provides methods to interact with the Devcal service.

Direct Known Subclasses

InsecureClient, SecureClient

Instance Method Summary collapse

Instance Method Details

#delete_event(**params) ⇒ Object

Deletes an event from the Devcal service.

Parameters:

  • params (Hash)

    The parameters for deleting the event.

Returns:

  • (Object)

    The response from the delete_event call.



55
56
57
# File 'lib/devcal.rb', line 55

def delete_event(**params)
  @stub.delete_event(::Devcal::DeleteEventParams.new(params), **@call_opts)
end

#get_event(**params) ⇒ Object

Retrieves an event from the Devcal service.

Parameters:

  • params (Hash)

    The parameters for retrieving the event.

Returns:

  • (Object)

    The response from the get_event call.



27
28
29
# File 'lib/devcal.rb', line 27

def get_event(**params)
  @stub.get_event(::Devcal::GetEventParams.new(params), **@call_opts)
end

#insert_event(**params) ⇒ Object

Inserts an event into the Devcal service.

Parameters:

  • params (Hash)

    The parameters for the event, including optional :Props.

Returns:

  • (Object)

    The response from the insert_event call.



18
19
20
21
# File 'lib/devcal.rb', line 18

def insert_event(**params)
  params[:props] = Google::Protobuf::Struct.from_hash(params[:props]) if params[:props]
  @stub.insert_event(::Devcal::InsertEventParams.new(params), **@call_opts)
end

#list_events(**params) ⇒ Object

Lists events from the Devcal service.

Parameters:

  • params (Hash)

    The parameters for listing events, including optional :Props.

Returns:

  • (Object)

    The response from the list_events call.



35
36
37
38
39
40
# File 'lib/devcal.rb', line 35

def list_events(**params)
  list_event_params = {}
  list_event_params[:range] = ::Devcal::ListEventsRange.new(date: params[:date], period: params[:period]) if params[:date] && params[:period]
  list_event_params[:props] = Google::Protobuf::Struct.from_hash(params[:props]) if params[:props]
  @stub.list_events(::Devcal::ListEventsParams.new(list_event_params), **@call_opts)
end

#update_event(**params) ⇒ Object

Updates an event in the Devcal service.

Parameters:

  • params (Hash)

    The parameters for updating the event, including optional :Props.

Returns:

  • (Object)

    The response from the update_event call.



46
47
48
49
# File 'lib/devcal.rb', line 46

def update_event(**params)
  params[:props] = Google::Protobuf::Struct.from_hash(params[:props]) if params[:props]
  @stub.update_event(::Devcal::UpdateEventParams.new(params), **@call_opts)
end