Module: Insightly2::DSL::Teams

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

Overview

Instance Method Summary collapse

Instance Method Details

#create_team(team: nil) ⇒ Insightly2::Resources::Team?

POST /v2.1/Teams Create a team.

Parameters:

  • team (Hash) (defaults to: nil)

    The team we’re creating.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



28
29
30
31
# File 'lib/insightly2/dsl/teams.rb', line 28

def create_team(team: nil)
  raise ArgumentError, "Team cannot be blank" if team.blank?
  Resources::Team.parse(request(:post, "Teams", team))
end

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

DELETE /v2.1/Teams/id Delete a team.

Parameters:

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

    A Team’s ID.

Returns:

  • (Faraday::Response)

    .

Raises:

  • (ArgumentError)

    If the method arguments are blank.



48
49
50
51
# File 'lib/insightly2/dsl/teams.rb', line 48

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

#get_team(id: nil) ⇒ Insightly2::Resources::Team

GET /v2.1/Teams/id Get a team.

Parameters:

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

    A team’s ID.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



11
12
13
14
# File 'lib/insightly2/dsl/teams.rb', line 11

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

#get_teamsArray?

GET /v2.1/Teams Get teams.

Returns:

  • (Array, nil)

    .



19
20
21
# File 'lib/insightly2/dsl/teams.rb', line 19

def get_teams
  Resources::Team.parse(request(:get, "Teams"))
end

#update_team(team: nil) ⇒ Insightly2::Resources::Team?

PUT /v2.1/Teams Update a team..

Parameters:

  • team (Hash) (defaults to: nil)

    The team we’re updating.

Returns:

Raises:

  • (ArgumentError)

    If the method arguments are blank.



38
39
40
41
# File 'lib/insightly2/dsl/teams.rb', line 38

def update_team(team: nil)
  raise ArgumentError, "Team cannot be blank" if team.blank?
  Resources::Team.parse(request(:put, 'Teams', team))
end