Class: Gitlab::GithubImport::Representation::LfsObject

Inherits:
Object
  • Object
show all
Includes:
ExposeAttribute, ToHash
Defined in:
lib/gitlab/github_import/representation/lfs_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ExposeAttribute

#[]

Methods included from ToHash

#convert_value_for_to_hash, #to_hash

Constructor Details

#initialize(attributes) ⇒ LfsObject

attributes - A Hash containing the raw lfs_object details. The keys of this

Hash must be Symbols.


30
31
32
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 30

def initialize(attributes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



10
11
12
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 10

def attributes
  @attributes
end

Class Method Details

.from_api_response(lfs_object, additional_data = {}) ⇒ Object

Builds a lfs_object



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

def self.from_api_response(lfs_object, additional_data = {})
  new(
    oid: lfs_object.oid,
    link: lfs_object.link,
    size: lfs_object.size
  )
end

.from_json_hash(raw_hash) ⇒ Object

Builds a new lfs_object using a Hash that was built from a JSON payload.



24
25
26
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 24

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

Instance Method Details

#github_identifiersObject



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

def github_identifiers
  {
    oid: oid,
    size: size
  }
end