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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ LfsObject

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

Hash must be Symbols.


28
29
30
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 28

def initialize(attributes)
  @attributes = attributes
end

Class Method Details

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

Builds a lfs_object



12
13
14
15
16
17
18
19
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 12

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

.from_json_hash(raw_hash) ⇒ Object

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



22
23
24
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 22

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

Instance Method Details

#github_identifiersObject



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

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