insightly2 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +113 -0
- data/Rakefile +6 -0
- data/config/gem_secret.yml.example +1 -0
- data/insightly2.gemspec +29 -0
- data/lib/insightly2/client.rb +54 -0
- data/lib/insightly2/dsl/comments.rb +47 -0
- data/lib/insightly2/dsl/contacts.rb +130 -0
- data/lib/insightly2/dsl/countries.rb +12 -0
- data/lib/insightly2/dsl/currencies.rb +12 -0
- data/lib/insightly2/dsl/custom_fields.rb +22 -0
- data/lib/insightly2/dsl/emails.rb +57 -0
- data/lib/insightly2/dsl/events.rb +52 -0
- data/lib/insightly2/dsl/file_attachments.rb +14 -0
- data/lib/insightly2/dsl/file_categories.rb +52 -0
- data/lib/insightly2/dsl/notes.rb +85 -0
- data/lib/insightly2/dsl/opportunities.rb +134 -0
- data/lib/insightly2/dsl/opportunity_categories.rb +52 -0
- data/lib/insightly2/dsl/opportunity_state_reasons.rb +12 -0
- data/lib/insightly2/dsl/organisations.rb +128 -0
- data/lib/insightly2/dsl/pipeline_stages.rb +22 -0
- data/lib/insightly2/dsl/pipelines.rb +22 -0
- data/lib/insightly2/dsl/project_categories.rb +52 -0
- data/lib/insightly2/dsl/projects.rb +129 -0
- data/lib/insightly2/dsl/relationships.rb +12 -0
- data/lib/insightly2/dsl/tags.rb +15 -0
- data/lib/insightly2/dsl/task_categories.rb +52 -0
- data/lib/insightly2/dsl/tasks.rb +76 -0
- data/lib/insightly2/dsl/team_members.rb +53 -0
- data/lib/insightly2/dsl/teams.rb +53 -0
- data/lib/insightly2/dsl/users.rb +22 -0
- data/lib/insightly2/dsl.rb +65 -0
- data/lib/insightly2/errors/client_error.rb +10 -0
- data/lib/insightly2/errors/resource_not_found_error.rb +8 -0
- data/lib/insightly2/errors.rb +10 -0
- data/lib/insightly2/resources/comment.rb +10 -0
- data/lib/insightly2/resources/contact.rb +8 -0
- data/lib/insightly2/resources/country.rb +8 -0
- data/lib/insightly2/resources/currency.rb +8 -0
- data/lib/insightly2/resources/custom_field.rb +8 -0
- data/lib/insightly2/resources/email.rb +8 -0
- data/lib/insightly2/resources/event.rb +8 -0
- data/lib/insightly2/resources/file_attachment.rb +8 -0
- data/lib/insightly2/resources/file_category.rb +8 -0
- data/lib/insightly2/resources/note.rb +8 -0
- data/lib/insightly2/resources/object/attributes.rb +71 -0
- data/lib/insightly2/resources/object/serializers.rb +102 -0
- data/lib/insightly2/resources/object.rb +29 -0
- data/lib/insightly2/resources/opportunity.rb +8 -0
- data/lib/insightly2/resources/opportunity_category.rb +8 -0
- data/lib/insightly2/resources/opportunity_state_reason.rb +8 -0
- data/lib/insightly2/resources/organisation.rb +8 -0
- data/lib/insightly2/resources/pipeline.rb +8 -0
- data/lib/insightly2/resources/pipeline_stage.rb +8 -0
- data/lib/insightly2/resources/project.rb +8 -0
- data/lib/insightly2/resources/project_category.rb +8 -0
- data/lib/insightly2/resources/relationship.rb +8 -0
- data/lib/insightly2/resources/tag.rb +8 -0
- data/lib/insightly2/resources/task.rb +8 -0
- data/lib/insightly2/resources/task_category.rb +8 -0
- data/lib/insightly2/resources/team.rb +8 -0
- data/lib/insightly2/resources/team_member.rb +8 -0
- data/lib/insightly2/resources/user.rb +8 -0
- data/lib/insightly2/resources.rb +33 -0
- data/lib/insightly2/utils/url_helper.rb +17 -0
- data/lib/insightly2/utils.rb +8 -0
- data/lib/insightly2/version.rb +3 -0
- data/lib/insightly2.rb +22 -0
- data/spec/fixtures/vcr_cassettes/create_comment_attachment.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_contact.yml +47 -0
- data/spec/fixtures/vcr_cassettes/create_contact_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_email_comment.yml +47 -0
- data/spec/fixtures/vcr_cassettes/create_event.yml +95 -0
- data/spec/fixtures/vcr_cassettes/create_file_category.yml +89 -0
- data/spec/fixtures/vcr_cassettes/create_note.yml +95 -0
- data/spec/fixtures/vcr_cassettes/create_note_comment.yml +47 -0
- data/spec/fixtures/vcr_cassettes/create_note_file.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_opportunity.yml +98 -0
- data/spec/fixtures/vcr_cassettes/create_opportunity_category.yml +89 -0
- data/spec/fixtures/vcr_cassettes/create_opportunity_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_organisation.yml +116 -0
- data/spec/fixtures/vcr_cassettes/create_organisation_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_project.yml +106 -0
- data/spec/fixtures/vcr_cassettes/create_project_category.yml +89 -0
- data/spec/fixtures/vcr_cassettes/create_project_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/create_task.yml +98 -0
- data/spec/fixtures/vcr_cassettes/create_task_category.yml +89 -0
- data/spec/fixtures/vcr_cassettes/create_task_comment.yml +47 -0
- data/spec/fixtures/vcr_cassettes/create_team.yml +92 -0
- data/spec/fixtures/vcr_cassettes/create_team_member.yml +89 -0
- data/spec/fixtures/vcr_cassettes/delete_comment.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_contact.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_contact_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_email.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_event.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_file_category.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_note.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_opportunity.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_opportunity_category.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_opportunity_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_organisation.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_organisation_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_project.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_project_category.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_project_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_task.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_task_category.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_team.yml +42 -0
- data/spec/fixtures/vcr_cassettes/delete_team_member.yml +42 -0
- data/spec/fixtures/vcr_cassettes/get_comment.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_contact.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_contact_emails.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_contact_image.yml +44 -0
- data/spec/fixtures/vcr_cassettes/get_contact_notes.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_contact_tasks.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_contacts.yml +184 -0
- data/spec/fixtures/vcr_cassettes/get_countries.yml +85 -0
- data/spec/fixtures/vcr_cassettes/get_currencies.yml +124 -0
- data/spec/fixtures/vcr_cassettes/get_custom_field.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_custom_fields.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_email.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_email_comments.yml +49 -0
- data/spec/fixtures/vcr_cassettes/get_emails.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_event.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_events.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_file_attachment.yml +4057 -0
- data/spec/fixtures/vcr_cassettes/get_file_categories.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_file_category.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_note.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_note_comments.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_notes.yml +52 -0
- data/spec/fixtures/vcr_cassettes/get_opportunities.yml +81 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity.yml +49 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_categories.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_category.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_emails.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_image.yml +44 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_notes.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_state_history.yml +83 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_state_reasons.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_opportunity_tasks.yml +49 -0
- data/spec/fixtures/vcr_cassettes/get_organisation.yml +55 -0
- data/spec/fixtures/vcr_cassettes/get_organisation_emails.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_organisation_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/get_organisation_notes.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_organisation_tasks.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_organisations.yml +2092 -0
- data/spec/fixtures/vcr_cassettes/get_pipeline.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_pipeline_stage.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_pipeline_stages.yml +49 -0
- data/spec/fixtures/vcr_cassettes/get_pipelines.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_project.yml +52 -0
- data/spec/fixtures/vcr_cassettes/get_project_categories.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_project_category.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_project_emails.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_project_image.yml +44 -0
- data/spec/fixtures/vcr_cassettes/get_project_notes.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_project_tasks.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_projects.yml +52 -0
- data/spec/fixtures/vcr_cassettes/get_task.yml +49 -0
- data/spec/fixtures/vcr_cassettes/get_task_categories.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_task_category.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_task_comments.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_tasks.yml +148 -0
- data/spec/fixtures/vcr_cassettes/get_team.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_team_member.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_team_members.yml +46 -0
- data/spec/fixtures/vcr_cassettes/get_teams.yml +47 -0
- data/spec/fixtures/vcr_cassettes/get_user.yml +48 -0
- data/spec/fixtures/vcr_cassettes/get_users.yml +48 -0
- data/spec/fixtures/vcr_cassettes/update_comment.yml +97 -0
- data/spec/fixtures/vcr_cassettes/update_contact.yml +94 -0
- data/spec/fixtures/vcr_cassettes/update_contact_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/update_event.yml +97 -0
- data/spec/fixtures/vcr_cassettes/update_file_category.yml +91 -0
- data/spec/fixtures/vcr_cassettes/update_note.yml +100 -0
- data/spec/fixtures/vcr_cassettes/update_opportunity.yml +100 -0
- data/spec/fixtures/vcr_cassettes/update_opportunity_category.yml +91 -0
- data/spec/fixtures/vcr_cassettes/update_opportunity_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/update_organisation.yml +118 -0
- data/spec/fixtures/vcr_cassettes/update_organisation_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/update_project.yml +109 -0
- data/spec/fixtures/vcr_cassettes/update_project_category.yml +91 -0
- data/spec/fixtures/vcr_cassettes/update_project_image.yml +42 -0
- data/spec/fixtures/vcr_cassettes/update_task.yml +100 -0
- data/spec/fixtures/vcr_cassettes/update_task_category.yml +91 -0
- data/spec/fixtures/vcr_cassettes/update_team.yml +94 -0
- data/spec/fixtures/vcr_cassettes/update_team_member.yml +91 -0
- data/spec/fixtures/vcr_cassettes/z_insightly_client_status_check.yml +48 -0
- data/spec/insightly2/client_spec.rb +12 -0
- data/spec/insightly2/dsl/comments_spec.rb +45 -0
- data/spec/insightly2/dsl/contacts_spec.rb +130 -0
- data/spec/insightly2/dsl/countries_spec.rb +14 -0
- data/spec/insightly2/dsl/currencies_spec.rb +14 -0
- data/spec/insightly2/dsl/custom_fields_spec.rb +25 -0
- data/spec/insightly2/dsl/emails_spec.rb +56 -0
- data/spec/insightly2/dsl/events_spec.rb +55 -0
- data/spec/insightly2/dsl/file_attachments_spec.rb +15 -0
- data/spec/insightly2/dsl/file_categories_spec.rb +55 -0
- data/spec/insightly2/dsl/notes_spec.rb +86 -0
- data/spec/insightly2/dsl/opportunities_spec.rb +143 -0
- data/spec/insightly2/dsl/opportunity_categories_spec.rb +55 -0
- data/spec/insightly2/dsl/opportunity_state_reasons_spec.rb +14 -0
- data/spec/insightly2/dsl/organisations_spec.rb +131 -0
- data/spec/insightly2/dsl/pipeline_stages_spec.rb +25 -0
- data/spec/insightly2/dsl/pipelines_spec.rb +25 -0
- data/spec/insightly2/dsl/project_categories_spec.rb +55 -0
- data/spec/insightly2/dsl/projects_spec.rb +131 -0
- data/spec/insightly2/dsl/task_categories_spec.rb +55 -0
- data/spec/insightly2/dsl/tasks_spec.rb +75 -0
- data/spec/insightly2/dsl/team_members_spec.rb +56 -0
- data/spec/insightly2/dsl/teams_spec.rb +55 -0
- data/spec/insightly2/dsl/users_spec.rb +25 -0
- data/spec/insightly2/resources/comment_spec.rb +27 -0
- data/spec/insightly2/resources/contact_spec.rb +28 -0
- data/spec/insightly2/resources/custom_field_spec.rb +22 -0
- data/spec/insightly2/resources/email_spec.rb +29 -0
- data/spec/insightly2/resources/event_spec.rb +29 -0
- data/spec/insightly2/resources/file_attachment_spec.rb +31 -0
- data/spec/insightly2/resources/file_category_spec.rb +21 -0
- data/spec/insightly2/resources/note_spec.rb +29 -0
- data/spec/insightly2/resources/opportunity_category_spec.rb +21 -0
- data/spec/insightly2/resources/opportunity_spec.rb +30 -0
- data/spec/insightly2/resources/organisation_spec.rb +29 -0
- data/spec/insightly2/resources/pipeline_spec.rb +21 -0
- data/spec/insightly2/resources/pipeline_stage_spec.rb +21 -0
- data/spec/insightly2/resources/project_category_spec.rb +21 -0
- data/spec/insightly2/resources/project_spec.rb +30 -0
- data/spec/insightly2/resources/task_category_spec.rb +21 -0
- data/spec/insightly2/resources/task_spec.rb +32 -0
- data/spec/insightly2/resources/team_member_spec.rb +21 -0
- data/spec/insightly2/resources/team_spec.rb +27 -0
- data/spec/insightly2/resources/user_spec.rb +29 -0
- data/spec/insightly2_spec.rb +15 -0
- data/spec/spec_helper.rb +20 -0
- metadata +551 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4042e33e70605bd4800030d09a4fce688cfb66fe
|
4
|
+
data.tar.gz: de8a94d18de1cfb5b3cbdd687cee6e22e83ac26d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b9bc887e4711454f4740e04da84a8132be583a6148ce539e561cd6f5c3554ee63e89478845c500f621f656dba9c60fdeb9915b49eac0cb7ee5f882703cb9e5eb
|
7
|
+
data.tar.gz: 73beb7c63bd6af0ae1ad06f9063c84c2927d7ca6d3634afead77eec2664e5b882448089a5c7794917050ab3570c4d89c5286cb2587cbe56b7580a5288c5f2580
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# Insightly2
|
2
|
+
|
3
|
+
Ruby Library for the Insightly REST API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'insightly2'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install insightly2
|
20
|
+
|
21
|
+
The gem requires Ruby 2.0.0 and above.
|
22
|
+
|
23
|
+
## Sample Code
|
24
|
+
|
25
|
+
Set client the API key.
|
26
|
+
```ruby
|
27
|
+
Insightly2.api_key = <your API key>
|
28
|
+
```
|
29
|
+
|
30
|
+
Get contacts.
|
31
|
+
```ruby
|
32
|
+
contacts = Insightly2.client.get_contacts
|
33
|
+
```
|
34
|
+
|
35
|
+
Get a contact.
|
36
|
+
```ruby
|
37
|
+
contact = Insightly2.client.get_contact(id: 1)
|
38
|
+
```
|
39
|
+
|
40
|
+
Create a contact.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# Build JSON serialized attributes.
|
44
|
+
# The gem won't do this for you. You need to build a serializer that meets your needs."
|
45
|
+
contact_attributes = {
|
46
|
+
"first_name"=>"Tyler",
|
47
|
+
"last_name"=>"Durden",
|
48
|
+
"image_url"=>"https://fakedomain.imgix.net/user_photos/man.jpg?crop=faces&fit=crop&h=96&w=96",
|
49
|
+
"contactinfos"=>[{"contact_id"=>0, "type"=>"Email", "subtype"=>"", "label"=>"Work", "detail"=>"tylerdurden@ucsv.edu"}],
|
50
|
+
"links"=>[],
|
51
|
+
"tags"=>[],
|
52
|
+
"date_created_utc"=>"2014-10-11 23:20:04",
|
53
|
+
"date_updated_utc"=>"2014-10-23 17:27:25",
|
54
|
+
"contact_id"=>81126408
|
55
|
+
}
|
56
|
+
|
57
|
+
# Create the contact.
|
58
|
+
contact = Insightly2.client.create_contact(contact: contact_attributes)
|
59
|
+
```
|
60
|
+
|
61
|
+
Update a contact.
|
62
|
+
```ruby
|
63
|
+
# Build JSON serialized attributes.
|
64
|
+
# The gem won't do this for you. You need to build a serializer that meets your needs."
|
65
|
+
# contact_attributes = <same as create>
|
66
|
+
|
67
|
+
# Update the contact.
|
68
|
+
contact = Insightly2.client.update_contact(contact: contact_attributes)
|
69
|
+
```
|
70
|
+
|
71
|
+
Delete a contact.
|
72
|
+
```ruby
|
73
|
+
Insightly2.client.delete_contact(id: 1)
|
74
|
+
```
|
75
|
+
|
76
|
+
## Error handling
|
77
|
+
|
78
|
+
The client will raise an ```Insightly2::Errors::ClientError``` if the action failed or
|
79
|
+
an ```Insightly2::Errors::ResourceNotFoundError``` if the target resource cannot be found in the API.
|
80
|
+
|
81
|
+
Depending on your implementation you may want to rescue these errors as follows:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
begin
|
85
|
+
Insightly2.client.delete_contact(id: 1)
|
86
|
+
rescue Insightly2::Errors::ResourceNotFoundError => e
|
87
|
+
Rails.logger.error "Insightly contact not found: #{e.response}"
|
88
|
+
rescue Insightly2::Errors::ClientError => e
|
89
|
+
Rails.logger.error "Insightly contact delete failed: #{e.response}"
|
90
|
+
end
|
91
|
+
```
|
92
|
+
If you don't care whether or not the resource is found you can simply do the following:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
begin
|
96
|
+
Insightly2.client.delete_contact(id: 1)
|
97
|
+
rescue Insightly2::Errors::ClientError => e
|
98
|
+
Rails.logger.error "Insightly contact delete failed: #{e.response}"
|
99
|
+
end
|
100
|
+
```
|
101
|
+
This will also catch ```Insightly2::Errors::ResourceNotFoundError``` but is less specific.
|
102
|
+
|
103
|
+
## API docs
|
104
|
+
|
105
|
+
[Insightly API Documentation](https://api.insight.ly/v2.1/Help)
|
106
|
+
|
107
|
+
## Contributing
|
108
|
+
|
109
|
+
1. Fork it ( https://github.com/insightly/ruby/fork )
|
110
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
111
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
112
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
113
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
insightly_api_key: 'YOUR TESTING API KEY GOES HERE'
|
data/insightly2.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'insightly2/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'insightly2'
|
8
|
+
spec.version = Insightly2::VERSION
|
9
|
+
spec.authors = ['Alexander Semyonov', 'Michael Kompanets', 'David Iorns']
|
10
|
+
spec.email = ['al@semyonov.us', 'michael@scienceexchange.com', 'david@scienceexchange.com']
|
11
|
+
spec.summary = 'A Ruby wrapper for the Insightly v2.1 API https://api.insight.ly/v2.1/Help'
|
12
|
+
spec.homepage = 'https://github.com/insightly/ruby'
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.required_ruby_version = '>= 2.0.0'
|
20
|
+
|
21
|
+
spec.add_dependency 'faraday'
|
22
|
+
spec.add_dependency 'activesupport'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0.0'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.18.0'
|
28
|
+
spec.add_development_dependency 'vcr'
|
29
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
require 'active_support/all'
|
5
|
+
require 'insightly2/dsl'
|
6
|
+
require 'insightly2/errors'
|
7
|
+
|
8
|
+
module Insightly2
|
9
|
+
class Client
|
10
|
+
include DSL
|
11
|
+
include Errors
|
12
|
+
|
13
|
+
URL = 'https://api.insight.ly/v2.1/'
|
14
|
+
REQUESTS = [:get, :post, :put, :delete]
|
15
|
+
HEADERS = {'Accept' => 'application/json', 'Content-Type' => 'application/json'}
|
16
|
+
|
17
|
+
# @param [String] api_key
|
18
|
+
def initialize(api_key = Insightly2.api_key)
|
19
|
+
@api_key = api_key
|
20
|
+
|
21
|
+
# Setup HTTP request connection to insightly.
|
22
|
+
@connection ||= Faraday.new do |builder|
|
23
|
+
builder.basic_auth @api_key, ''
|
24
|
+
builder.request :url_encoded
|
25
|
+
builder.response :logger if Insightly2.logger
|
26
|
+
builder.adapter Faraday.default_adapter
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [:get, :post, :put, :delete] method.
|
31
|
+
# @param [String] path.
|
32
|
+
# @param [Hash] query (optional).
|
33
|
+
# @param [Hash] headers request headers (optional).
|
34
|
+
# @raise [ArgumentError] If the response is blank.
|
35
|
+
# @raise [ResourceNotFoundError] If the response code is 404.
|
36
|
+
# @raise [ClientError] If the response code is not in the success range.
|
37
|
+
# @return [Faraday::Response] server response.
|
38
|
+
def request(method, path, query = {}, headers = HEADERS)
|
39
|
+
raise ArgumentError, "Unsupported method #{method.inspect}. Only :get, :post, :put, :delete are allowed" unless REQUESTS.include?(method)
|
40
|
+
|
41
|
+
payload = !query.empty? ? JSON.generate(query) : ''
|
42
|
+
response = @connection.run_request(method, "#{URL}#{path}", payload, headers)
|
43
|
+
|
44
|
+
case response.status.to_i
|
45
|
+
when 200..299
|
46
|
+
return response
|
47
|
+
when 404
|
48
|
+
raise ResourceNotFoundError.new(response: response)
|
49
|
+
else
|
50
|
+
raise ClientError.new(response: response)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::Comments
|
5
|
+
# GET /v2.1/Comments/{id}
|
6
|
+
# Get a comment.
|
7
|
+
# @param [String, Fixnum] id A comment's ID.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::Comment, nil].
|
10
|
+
def get_comment(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::Comment.parse(request(:get, "Comments/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# POST /v2.1/Comments?c_id={c_id}&filename={filename}
|
16
|
+
# Adds a file attachment to a comment.
|
17
|
+
# @param [String, Fixnum] id A comment's ID.
|
18
|
+
# @param [String] filename The name of the attachment.
|
19
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
20
|
+
# @return [Faraday::Response].
|
21
|
+
def create_comment_attachment(id:, filename:)
|
22
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
23
|
+
raise ArgumentError, "Filename cannot be blank" if filename.blank?
|
24
|
+
request(:post, "Comments/?c_id=#{id}&filename=#{filename}")
|
25
|
+
end
|
26
|
+
|
27
|
+
# PUT /v2.1/Comments
|
28
|
+
# Updates a comment.
|
29
|
+
# @param [Hash] comment The comment to update.
|
30
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
31
|
+
# @return [Insightly2::Resources::Comment, nil].
|
32
|
+
def update_comment(comment:)
|
33
|
+
raise ArgumentError, "Comment cannot be blank" if comment.blank?
|
34
|
+
Resources::Comment.parse(request(:put, "Comments", comment))
|
35
|
+
end
|
36
|
+
|
37
|
+
# DELETE /v2.1/Comments/{id}
|
38
|
+
# Deletes a comment.
|
39
|
+
# @param [String, Fixnum] id A comment's ID.
|
40
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
41
|
+
# @return [Faraday::Response].
|
42
|
+
def delete_comment(id:)
|
43
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
44
|
+
request(:delete, "Comments/#{id}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::Contacts
|
5
|
+
# GET /v2.1/Contacts/{id}
|
6
|
+
# Gets a contact by id.
|
7
|
+
# @param [String, Fixnum] id The ID of the contact.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::Contact, nil].
|
10
|
+
def get_contact(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::Contact.parse(request(:get, "Contacts/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /v2.1/Contacts/{c_id}/Emails
|
16
|
+
# Gets a contact's emails.
|
17
|
+
# @param [id:] id of the contact.
|
18
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
19
|
+
# @return [Array, nil].
|
20
|
+
def get_contact_emails(id:)
|
21
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
22
|
+
Resources::Email.parse(request(:get, "Contacts/#{id}/Emails"))
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /v2.1/Contacts/{c_id}/Image
|
26
|
+
# Gets a contact's image.
|
27
|
+
# @param [String, Fixnum] id The ID of the contact.
|
28
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
29
|
+
# @return [Faraday::Response].
|
30
|
+
def get_contact_image(id:)
|
31
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
32
|
+
request(:get, "Contacts/#{id}/Image")
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /v2.1/Contacts/{c_id}/Notes
|
36
|
+
# Gets a contact's notes.
|
37
|
+
# @param [String, Fixnum] id The ID of the contact.
|
38
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
39
|
+
# @return [Array, nil].
|
40
|
+
def get_contact_notes(id:)
|
41
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
42
|
+
Resources::Note.parse(request(:get, "Contacts/#{id}/Notes"))
|
43
|
+
end
|
44
|
+
|
45
|
+
# GET /v2.1/Contacts/{c_id}/Tasks
|
46
|
+
# Gets a contact's tasks.
|
47
|
+
# @param [String, Fixnum] id The ID of the contact.
|
48
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
49
|
+
# @return [Array, nil].
|
50
|
+
def get_contact_tasks(id:)
|
51
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
52
|
+
Resources::Task.parse(request(:get, "Contacts/#{id}/Tasks"))
|
53
|
+
end
|
54
|
+
|
55
|
+
# GET /v2.1/Contacts?ids={ids}&email={email}&tag={tag}
|
56
|
+
# Get a list of contacts.
|
57
|
+
# @param [Array] ids The contact ids of the contacts to return (optional).
|
58
|
+
# @param [String] email The email address of the contact to return (optional).
|
59
|
+
# @param [String] tag The tag that has been applied to contacts (optional).
|
60
|
+
# @return [Array, nil].
|
61
|
+
def get_contacts(ids: [], email: '', tag: '')
|
62
|
+
url = Utils::UrlHelper.build_url(path: "Contacts", params: {ids: ids.join(','), email: email, tag: tag})
|
63
|
+
Resources::Contact.parse(request(:get, url))
|
64
|
+
end
|
65
|
+
|
66
|
+
# POST /v2.1/Contacts
|
67
|
+
# Creates a contact.
|
68
|
+
# @param [Hash] contact The contact to create.
|
69
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
70
|
+
# @return [Insightly2::Resources::Contact, nil].
|
71
|
+
def create_contact(contact:)
|
72
|
+
raise ArgumentError, "Contact cannot be blank" if contact.blank?
|
73
|
+
Resources::Contact.parse(request(:post, "Contacts", contact))
|
74
|
+
end
|
75
|
+
|
76
|
+
# POST /v2.1/Contacts/{c_id}/Image/{filename}
|
77
|
+
# Adds a contact's image.
|
78
|
+
# @param [String, Fixnum] id The ID of the contact.
|
79
|
+
# @param [String] filename The name of image file to be attached to the contact.
|
80
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
81
|
+
# @return [Faraday::Response].
|
82
|
+
def create_contact_image(id:, filename:)
|
83
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
84
|
+
raise ArgumentError, "Filename cannot be blank" if filename.blank?
|
85
|
+
request(:post, "Contacts/#{id}/Image/#{filename}")
|
86
|
+
end
|
87
|
+
|
88
|
+
# PUT /v2.1/Contacts
|
89
|
+
# Updates a contact.
|
90
|
+
# @param [Hash] contact The contact to update.
|
91
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
92
|
+
# @return [Insightly2::Resources::Contact, nil].
|
93
|
+
def update_contact(contact:)
|
94
|
+
raise ArgumentError, "Contact cannot be blank" if contact.blank?
|
95
|
+
Resources::Contact.parse(request(:put, "Contacts", contact))
|
96
|
+
end
|
97
|
+
|
98
|
+
# PUT /v2.1/Contacts/{c_id}/Image/{filename}
|
99
|
+
# Updates a contact's image.
|
100
|
+
# @param [String, Fixnum] id The ID of the contact.
|
101
|
+
# @param [String] filename The name of image file to be attached to the contact.
|
102
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
103
|
+
# @return [Faraday::Response].
|
104
|
+
def update_contact_image(id:, filename:)
|
105
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
106
|
+
raise ArgumentError, "Filename cannot be blank" if filename.blank?
|
107
|
+
request(:put, "Contacts/#{id}/Image/#{filename}")
|
108
|
+
end
|
109
|
+
|
110
|
+
# DELETE /v2.1/Contacts/{id}
|
111
|
+
# Deletes a contact.
|
112
|
+
# @param [String, Fixnum] id The ID of the contact to delete.
|
113
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
114
|
+
# @return [Faraday::Response].
|
115
|
+
def delete_contact(id:)
|
116
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
117
|
+
request(:delete, "Contacts/#{id}")
|
118
|
+
end
|
119
|
+
|
120
|
+
# DELETE /v2.1/Contacts/{c_id}/Image
|
121
|
+
# Deletes a contact's image.
|
122
|
+
# @param [String, Fixnum] id The ID of the contact with the image to delete.
|
123
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
124
|
+
# @return [Faraday::Response].
|
125
|
+
def delete_contact_image(id:)
|
126
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
127
|
+
request(:delete, "Contacts/#{id}/Image")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::CustomFields
|
5
|
+
# GET /v2.1/CustomFields/{id}
|
6
|
+
# Get a custom field.
|
7
|
+
# @param [String, Fixnum] id A CustomField's ID.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::CustomField, nil].
|
10
|
+
def get_custom_field(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::CustomField.parse(request(:get, "CustomFields/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /v2.1/CustomFields
|
16
|
+
# Get a list of custom fields.
|
17
|
+
# @return [Array, nil].
|
18
|
+
def get_custom_fields
|
19
|
+
Resources::CustomField.parse(request(:get, "CustomFields"))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::Emails
|
5
|
+
# GET /v2.1/Emails/{id}
|
6
|
+
# Gets an email.
|
7
|
+
# @param [String, Fixnum] id The ID of the email.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::Email, nil]
|
10
|
+
def get_email(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::Email.parse(request(:get, "Emails/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /v2.1/Emails/{c_id}/Comments
|
16
|
+
# Gets an email's comments.
|
17
|
+
# @param [String, Fixnum] id The ID of the email.
|
18
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
19
|
+
# @return [Array, nil].
|
20
|
+
def get_email_comments(id:)
|
21
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
22
|
+
Resources::Comment.parse(request(:get, "Emails/#{id}/Comments"))
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /v2.1/Emails?ids={ids}&tag={tag}
|
26
|
+
# Gets a list of Emails.
|
27
|
+
# @param [Array] ids The list of email IDs (optional).
|
28
|
+
# @param [String] tag Emails tagged with this tag (optional).
|
29
|
+
# @return [Array, nil].
|
30
|
+
def get_emails(ids: [], tag: '')
|
31
|
+
url = Utils::UrlHelper.build_url(path: "Emails", params: {ids: ids.join(','), tag: tag})
|
32
|
+
Resources::Email.parse(request(:get, url))
|
33
|
+
end
|
34
|
+
|
35
|
+
# POST /v2.1/Emails/{c_id}/Comments
|
36
|
+
# Create a comment for a task.
|
37
|
+
# @param [String, Fixnum] id A task's ID.
|
38
|
+
# @param [Hash] comment The comment to create.
|
39
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
40
|
+
# @return [Faraday::Response].
|
41
|
+
def create_email_comment(id:, comment:)
|
42
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
43
|
+
raise ArgumentError, "Comment cannot be blank" if comment.blank?
|
44
|
+
request(:post, "Emails/#{id}/Comments", comment)
|
45
|
+
end
|
46
|
+
|
47
|
+
# DELETE /v2.1/Emails/{id}
|
48
|
+
# Deletes an email.
|
49
|
+
# @param [String, Fixnum] id The ID of the email to delete.
|
50
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
51
|
+
# @return [Faraday::Response].
|
52
|
+
def delete_email(id:)
|
53
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
54
|
+
request(:delete, "Emails/#{id}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::Events
|
5
|
+
# GET /v2.1/Events/{id}
|
6
|
+
# Get an event.
|
7
|
+
# @param [String, Fixnum] id An event's ID.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::Event, nil].
|
10
|
+
def get_event(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::Event.parse(request(:get, "Events/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /v2.1/Events
|
16
|
+
# Get a list of events.
|
17
|
+
# @return [Insightly2::Resources::Event, nil]
|
18
|
+
def get_events
|
19
|
+
Resources::Event.parse(request(:get, "Events"))
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /v2.1/Events
|
23
|
+
# Create an event.
|
24
|
+
# @param [Hash] event The event to create.
|
25
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
26
|
+
# @return [Insightly2::Resources::Event, nil]
|
27
|
+
def create_event(event:)
|
28
|
+
raise ArgumentError, "Event cannot be blank" if event.blank?
|
29
|
+
Resources::Event.parse(request(:post, "Events", event))
|
30
|
+
end
|
31
|
+
|
32
|
+
# PUT /v2.1/Events
|
33
|
+
# Update an event.
|
34
|
+
# @param [Hash] event The event to update.
|
35
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
36
|
+
# @return [Insightly2::Resources::Event, nil]
|
37
|
+
def update_event(event:)
|
38
|
+
raise ArgumentError, "Event cannot be blank" if event.blank?
|
39
|
+
Resources::Event.parse(request(:put, "Events", event))
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /v2.1/Events/{id}
|
43
|
+
# Delete an event.
|
44
|
+
# @param [String, Fixnum] id An event's ID.
|
45
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
46
|
+
# @return [Faraday::Response].
|
47
|
+
def delete_event(id:)
|
48
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
49
|
+
request(:delete, "Events/#{id}")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::FileAttachments
|
5
|
+
# GET /v2.1/FileAttachments/{id}
|
6
|
+
# @param [String, Fixnum] id A file attachment's ID.
|
7
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
8
|
+
# @return [Faraday::Response].
|
9
|
+
def get_file_attachment(id:)
|
10
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
11
|
+
request(:get, "FileAttachments/#{id}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'insightly2/dsl'
|
2
|
+
|
3
|
+
module Insightly2
|
4
|
+
module DSL::FileCategories
|
5
|
+
# GET /v2.1/FileCategories/{id}
|
6
|
+
# Get a file category.
|
7
|
+
# @param [String, Fixnum] id: A file category's ID.
|
8
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
9
|
+
# @return [Insightly2::Resources::FileCategory, nil].
|
10
|
+
def get_file_category(id:)
|
11
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
12
|
+
Resources::FileCategory.parse(request(:get, "FileCategories/#{id}"))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /v2.1/FileCategories
|
16
|
+
# Get a list of file categories.
|
17
|
+
# @return [Array, nil].
|
18
|
+
def get_file_categories
|
19
|
+
Resources::FileCategory.parse(request(:get, "FileCategories"))
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /v2.1/FileCategories
|
23
|
+
# Create a file category.
|
24
|
+
# @param [Hash] category: File Category attributes.
|
25
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
26
|
+
# @return [Insightly2::Resources::FileCategory, nil].
|
27
|
+
def create_file_category(category:)
|
28
|
+
raise ArgumentError, "Category cannot be blank" if category.blank?
|
29
|
+
Resources::FileCategory.parse(request(:post, "FileCategories", category))
|
30
|
+
end
|
31
|
+
|
32
|
+
# PUT /v2.1/FileCategories
|
33
|
+
# Update a file category.
|
34
|
+
# @param [Hash] category: File Category attributes.
|
35
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
36
|
+
# @return [Insightly2::Resources::FileCategory].
|
37
|
+
def update_file_category(category:)
|
38
|
+
raise ArgumentError, "Category cannot be blank" if category.blank?
|
39
|
+
Resources::FileCategory.parse(request(:put, "FileCategories", category))
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /v2.1/FileCategories/{id}
|
43
|
+
# Delete a file category.
|
44
|
+
# @param [String, Fixnum] id: A file category's ID.
|
45
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
46
|
+
# @return [Faraday::Response].
|
47
|
+
def delete_file_category(id:)
|
48
|
+
raise ArgumentError, "ID cannot be blank" if id.blank?
|
49
|
+
request(:delete, "FileCategories/#{id}")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|