Class: Gitlab::GithubImport::Representation::Collaborator
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Representation::Collaborator
- Includes:
- ExposeAttribute, ToHash
- Defined in:
- lib/gitlab/github_import/representation/collaborator.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
-
.from_api_response(collaborator, _additional_data = {}) ⇒ Object
Builds a user from a GitHub API response.
-
.from_json_hash(raw_hash) ⇒ Object
Builds a user using a Hash that was built from a JSON payload.
Instance Method Summary collapse
- #github_identifiers ⇒ Object
-
#initialize(attributes) ⇒ Collaborator
constructor
attributes - A Hash containing the user details.
Methods included from ExposeAttribute
Methods included from ToHash
#convert_value_for_to_hash, #to_hash
Constructor Details
#initialize(attributes) ⇒ Collaborator
attributes - A Hash containing the user details. The keys of this
Hash (and any nested hashes) must be symbols.
32 33 34 |
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 32 def initialize(attributes) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 10 def 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.
17 18 19 20 21 22 23 |
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 17 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.
26 27 28 |
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 26 def self.from_json_hash(raw_hash) new(Representation.symbolize_hash(raw_hash)) end |
Instance Method Details
#github_identifiers ⇒ Object
36 37 38 39 40 41 |
# File 'lib/gitlab/github_import/representation/collaborator.rb', line 36 def github_identifiers { id: id, login: login } end |