Module: Insightly2::DSL::FileCategories

Included in:
Insightly2::DSL
Defined in:
lib/insightly2/dsl/file_categories.rb

Instance Method Summary collapse

Instance Method Details

#create_file_category(category: nil) ⇒ Insightly2::Resources::FileCategory?

POST /v2.1/FileCategories Create a file category.

Parameters:

  • category: (Hash) (defaults to: nil)

    File Category attributes.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



27
28
29
30
# File 'lib/insightly2/dsl/file_categories.rb', line 27

def create_file_category(category: nil)
  raise ArgumentError, "Category cannot be blank" if category.blank?
  Resources::FileCategory.parse(request(:post, "FileCategories", category))
end

#delete_file_category(id: nil) ⇒ Faraday::Response

DELETE /v2.1/FileCategories/id Delete a file category.

Parameters:

  • id: (String, Fixnum) (defaults to: nil)

    A file category’s ID.

Returns:

  • (Faraday::Response)

    .

Raises:

  • (ArgumentError)

    If the method arguments are blank.



47
48
49
50
# File 'lib/insightly2/dsl/file_categories.rb', line 47

def delete_file_category(id: nil)
  raise ArgumentError, "ID cannot be blank" if id.blank?
  request(:delete, "FileCategories/#{id}")
end

#get_file_categoriesArray?

GET /v2.1/FileCategories Get a list of file categories.

Returns:

  • (Array, nil)

    .



18
19
20
# File 'lib/insightly2/dsl/file_categories.rb', line 18

def get_file_categories
  Resources::FileCategory.parse(request(:get, "FileCategories"))
end

#get_file_category(id: nil) ⇒ Insightly2::Resources::FileCategory?

GET /v2.1/FileCategories/id Get a file category.

Parameters:

  • id: (String, Fixnum) (defaults to: nil)

    A file category’s ID.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



10
11
12
13
# File 'lib/insightly2/dsl/file_categories.rb', line 10

def get_file_category(id: nil)
  raise ArgumentError, "ID cannot be blank" if id.blank?
  Resources::FileCategory.parse(request(:get, "FileCategories/#{id}"))
end

#update_file_category(category: nil) ⇒ Insightly2::Resources::FileCategory

PUT /v2.1/FileCategories Update a file category.

Parameters:

  • category: (Hash) (defaults to: nil)

    File Category attributes.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



37
38
39
40
# File 'lib/insightly2/dsl/file_categories.rb', line 37

def update_file_category(category: nil)
  raise ArgumentError, "Category cannot be blank" if category.blank?
  Resources::FileCategory.parse(request(:put, "FileCategories", category))
end