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 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.

26
27
28
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 26

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) ⇒ Object

Builds a lfs_object


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

def self.from_api_response(lfs_object)
  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.


20
21
22
# File 'lib/gitlab/github_import/representation/lfs_object.rb', line 20

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