Module: Insightly2::DSL::Emails
- Included in:
- Insightly2::DSL
- Defined in:
- lib/insightly2/dsl/emails.rb
Instance Method Summary collapse
-
#create_email_comment(id: nil, comment: nil) ⇒ Faraday::Response
POST /v2.1/Emails/c_id/Comments Create a comment for a task.
-
#delete_email(id: nil) ⇒ Faraday::Response
DELETE /v2.1/Emails/id Deletes an email.
-
#get_email(id: nil) ⇒ Insightly2::Resources::Email?
GET /v2.1/Emails/id Gets an email.
-
#get_email_comments(id: nil) ⇒ Array?
GET /v2.1/Emails/c_id/Comments Gets an email’s comments.
-
#get_emails(ids: [], tag: '') ⇒ Array?
GET /v2.1/Emails?ids=ids&tag=tag Gets a list of Emails.
Instance Method Details
#create_email_comment(id: nil, comment: nil) ⇒ Faraday::Response
POST /v2.1/Emails/c_id/Comments Create a comment for a task.
41 42 43 44 45 |
# File 'lib/insightly2/dsl/emails.rb', line 41 def create_email_comment(id: nil, comment: nil) raise ArgumentError, "ID cannot be blank" if id.blank? raise ArgumentError, "Comment cannot be blank" if comment.blank? request(:post, "Emails/#{id}/Comments", comment) end |
#delete_email(id: nil) ⇒ Faraday::Response
DELETE /v2.1/Emails/id Deletes an email.
52 53 54 55 |
# File 'lib/insightly2/dsl/emails.rb', line 52 def delete_email(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? request(:delete, "Emails/#{id}") end |
#get_email(id: nil) ⇒ Insightly2::Resources::Email?
GET /v2.1/Emails/id Gets an email.
10 11 12 13 |
# File 'lib/insightly2/dsl/emails.rb', line 10 def get_email(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? Resources::Email.parse(request(:get, "Emails/#{id}")) end |
#get_email_comments(id: nil) ⇒ Array?
GET /v2.1/Emails/c_id/Comments Gets an email’s comments.
20 21 22 23 |
# File 'lib/insightly2/dsl/emails.rb', line 20 def get_email_comments(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? Resources::Comment.parse(request(:get, "Emails/#{id}/Comments")) end |
#get_emails(ids: [], tag: '') ⇒ Array?
GET /v2.1/Emails?ids=ids&tag=tag Gets a list of Emails.
30 31 32 33 |
# File 'lib/insightly2/dsl/emails.rb', line 30 def get_emails(ids: [], tag: '') url = Utils::UrlHelper.build_url(path: "Emails", params: {ids: ids.join(','), tag: tag}) Resources::Email.parse(request(:get, url)) end |