Class: Gitlab::GithubImport::Representation::Collaborator

Inherits:
Object
  • Object
show all
Includes:
Representable
Defined in:
lib/gitlab/github_import/representation/collaborator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Collaborator

attributes - A Hash containing the user details. The keys of this Hash (and any nested hashes) must be symbols.



29
30
31
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 29

def initialize(attributes)
  @attributes = attributes
end

Class Method Details

.from_api_response(collaborator, _additional_data = {}) ⇒ Object

Builds a user from a GitHub API response.

collaborator - An instance of Hash containing the user & role details.



14
15
16
17
18
19
20
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 14

def self.from_api_response(collaborator, _additional_data = {})
  new(
    id: collaborator[:id],
    login: collaborator[:login],
    role_name: collaborator[:role_name]
  )
end

.from_json_hash(raw_hash) ⇒ Object

Builds a user using a Hash that was built from a JSON payload.



23
24
25
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 23

def self.from_json_hash(raw_hash)
  new(Representation.symbolize_hash(raw_hash))
end

Instance Method Details

#github_identifiersObject



33
34
35
36
37
38
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 33

def github_identifiers
  {
    id: id,
    login: 
  }
end