Class: ESP::Team

Inherits:
Resource show all
Defined in:
lib/esp/resources/team.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dirty

#changed_attributes, #original_attributes, #original_attributes=

Methods included from LoadWithOriginalAttributes

#load

Class Method Details

.allActiveResource::PaginatedCollection<ESP::Team>

Return a paginated Team list



# File 'lib/esp/resources/team.rb', line 69

.create(attributes = {}) ⇒ ESP::Team

Create a Team. call-seq -> super.create(attributes={})

Examples:

team = ESP::Team.create(name: "Team Name", sub_organization_id: 9)

Parameters:

  • attributes (Hash) (defaults to: {})

    Required hash of team attributes.

    Valid Attributes

    See API documentation for valid arguments

Returns:



# File 'lib/esp/resources/team.rb', line 74

.find(id, options = {}) ⇒ ESP::Team

Find a Team by id

call-seq -> super.find(id, options = {})

Parameters:

  • id (Integer, Numeric, #to_i)

    Required ID of the team to retrieve.

  • options (Hash) (defaults to: {})

    Optional hash of options.

    Valid Options

    include | The list of associated objects to return on the initial request.

    Valid Includable Associations

    See API documentation for valid arguments

Returns:



# File 'lib/esp/resources/team.rb', line 53

.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Team>

Return a paginated Team list filtered by search parameters

call-seq -> super.where(clauses = {})

Parameters:

  • clauses (Hash) (defaults to: {})

    A hash of attributes with appended predicates to search, sort and include.

    Valid Clauses

    See API documentation for valid arguments

Returns:



# File 'lib/esp/resources/team.rb', line 42

Instance Method Details

#create_reportESP::Report

Enqueue a report to be run for this team. Returns a Report object with a status of ‘queued’ and an id Periodically check the API

ESP::Report.find(<id>)

until status is ‘complete’. If not successful, returns a Report object with the errors object populated.

Returns:



38
39
40
# File 'lib/esp/resources/team.rb', line 38

def create_report
  Report.create_for_team(id)
end

#custom_signaturesActiveResource::PaginatedCollection<ESP::CustomSignature>

The collection of custom_signatures that belong to the team.



26
27
28
# File 'lib/esp/resources/team.rb', line 26

def custom_signatures
  CustomSignature.where(teams_id_eq: id)
end

#destroyself

Delete a Team.

Returns:

  • (self)


# File 'lib/esp/resources/team.rb', line 102

#external_accountsActiveResource::PaginatedCollection<ESP::ExternalAccount>

The collection of external_accounts that belong to the team.



16
# File 'lib/esp/resources/team.rb', line 16

has_many :external_accounts, class_name: 'ESP::ExternalAccount'

#organizationESP::Organization

The organization this team belongs to.

Returns:



6
# File 'lib/esp/resources/team.rb', line 6

belongs_to :organization, class_name: 'ESP::Organization'

#reportsActiveResource::PaginatedCollection<ESP::Report>

The collection of reports that belong to the team.



21
# File 'lib/esp/resources/team.rb', line 21

has_many :reports, class_name: 'ESP::Report'

#saveBoolean

Create and update a Team.

Valid Attributes when updating

name | Required | The new name of the team

Valid Attributes when creating

See API documentation for valid arguments

Examples:

team = ESP::Team.new(name: "Team Name", sub_organization_id: 9)
team.save

Returns:

  • (Boolean)


# File 'lib/esp/resources/team.rb', line 86

#sub_organizationESP::SubOrganization

The sub organization this team belongs to.



11
# File 'lib/esp/resources/team.rb', line 11

belongs_to :sub_organization, class_name: 'ESP::SubOrganization'