Class: StarkInfra::PixDirector

Inherits:
StarkCore::Utils::SubResource
  • Object
show all
Defined in:
lib/pixdirector/pixdirector.rb

Overview

# PixDirector object

Mandatory data that must be registered within the Central Bank for emergency contact purposes.

When you initialize a PixDirector, the entity will not be automatically created in the Stark Infra API. The ‘create’ function sends the objects to the Stark Infra API and returns the created object.

## Parameters (required):

  • name [string]: name of the PixDirector. ex: ‘Edward Stark’.

  • tax_id [string]: tax ID (CPF) of the PixDirector. ex: ‘012.345.678-90’

  • phone [string]: phone of the PixDirector. ex: ‘+551198989898’

  • email [string]: email of the PixDirector. ex: ‘[email protected]

  • password [string]: password of the PixDirector. ex: ‘12345678’

  • team_email [string]: team email. ex: ‘[email protected]

  • team_phones [list of strings]: list of phones of the team. ex: [‘+5511988889999’, ‘+5511988889998’]

## Attributes (return-only):

  • status [string]: current PixDirector status. ex: ‘success’

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, status: nil) ⇒ PixDirector

Returns a new instance of PixDirector.



29
30
31
32
33
34
35
36
37
38
# File 'lib/pixdirector/pixdirector.rb', line 29

def initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, status: nil)
  @name = name
  @tax_id = tax_id
  @phone = phone
  @email = email
  @password = password
  @team_email = team_email
  @team_phones = team_phones
  @status = status
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def name
  @name
end

#passwordObject (readonly)

Returns the value of attribute password.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def password
  @password
end

#phoneObject (readonly)

Returns the value of attribute phone.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def phone
  @phone
end

#statusObject (readonly)

Returns the value of attribute status.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def status
  @status
end

#tax_idObject (readonly)

Returns the value of attribute tax_id.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def tax_id
  @tax_id
end

#team_emailObject (readonly)

Returns the value of attribute team_email.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def team_email
  @team_email
end

#team_phonesObject (readonly)

Returns the value of attribute team_phones.



28
29
30
# File 'lib/pixdirector/pixdirector.rb', line 28

def team_phones
  @team_phones
end

Class Method Details

.create(director, user: nil) ⇒ Object

# Create a PixDirector

Send a PixDirector object for creation in the Stark Infra API

## Parameters (required):

  • director [PixDirector object]: PixDirector object to be created in the API. ex: PixDirector.new()

## Parameters (optional):

  • user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call

## Return:

  • PixDirector object with updated attributes.



52
53
54
# File 'lib/pixdirector/pixdirector.rb', line 52

def self.create(director, user: nil)
  StarkInfra::Utils::Rest.post_single(entity: director, user: user, **resource)
end

.resourceObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/pixdirector/pixdirector.rb', line 56

def self.resource
  {
    resource_name: 'PixDirector',
    resource_maker: proc { |json|
      PixDirector.new(
        name: json['name'],
        tax_id: json['tax_id'],
        phone: json['phone'],
        email: json['email'],
        password: json['password'],
        team_email: json['team_email'],
        team_phones: json['team_phones'],
        status: json['status']
      )
    }
  }
end