Class: Leash::Integrations::Gmail
- Inherits:
-
Base
- Object
- Base
- Leash::Integrations::Gmail
show all
- Defined in:
- lib/leash/integrations/gmail.rb
Overview
‘leash.integrations.gmail` — mirrors TS `leash.integrations.gmail`.
Constant Summary
collapse
- PROVIDER =
"gmail"
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#get_message(message_id, format: "full") ⇒ Object
27
28
29
|
# File 'lib/leash/integrations/gmail.rb', line 27
def get_message(message_id, format: "full")
call("get-message", { "messageId" => message_id, "format" => format })
end
|
#get_profile ⇒ Object
55
56
57
|
# File 'lib/leash/integrations/gmail.rb', line 55
def get_profile
call("get-profile")
end
|
#list_labels ⇒ Object
51
52
53
|
# File 'lib/leash/integrations/gmail.rb', line 51
def list_labels
call("list-labels")
end
|
#list_messages(query: nil, max_results: nil, label_ids: nil, page_token: nil) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/leash/integrations/gmail.rb', line 15
def list_messages(query: nil, max_results: nil, label_ids: nil, page_token: nil)
params = compact_params(
"query" => query,
"maxResults" => max_results,
"labelIds" => label_ids,
"pageToken" => page_token
)
call("list-messages", params.empty? ? nil : params)
end
|
#search_messages(query, max_results: nil) ⇒ Object
45
46
47
48
49
|
# File 'lib/leash/integrations/gmail.rb', line 45
def search_messages(query, max_results: nil)
params = { "query" => query }
params["maxResults"] = max_results unless max_results.nil?
call("search-messages", params)
end
|
#send_message(to:, subject:, body:, cc: nil, bcc: nil) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/leash/integrations/gmail.rb', line 36
def send_message(to:, subject:, body:, cc: nil, bcc: nil)
params = compact_params(
"to" => to, "subject" => subject, "body" => body, "cc" => cc, "bcc" => bcc
)
call("send-message", params)
end
|