debian-mirror-gitlab/lib/gitlab/github_import/representation/lfs_object.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1,013 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
module Gitlab
module GithubImport
module Representation
class LfsObject
include ToHash
include ExposeAttribute
attr_reader :attributes
2019-02-02 18:00:53 +05:30
expose_attribute :oid, :link, :size
2018-11-08 19:23:39 +05:30
# Builds a lfs_object
2022-08-27 11:52:29 +05:30
def self.from_api_response(lfs_object, additional_data = {})
2021-06-08 01:23:25 +05:30
new(
oid: lfs_object.oid,
link: lfs_object.link,
2021-11-18 22:05:49 +05:30
size: lfs_object.size
2021-06-08 01:23:25 +05:30
)
2018-11-08 19:23:39 +05:30
end
# Builds a new lfs_object using a Hash that was built from a JSON payload.
def self.from_json_hash(raw_hash)
new(Representation.symbolize_hash(raw_hash))
end
# attributes - A Hash containing the raw lfs_object details. The keys of this
# Hash must be Symbols.
def initialize(attributes)
@attributes = attributes
end
2021-11-18 22:05:49 +05:30
def github_identifiers
{
oid: oid
}
end
2018-11-08 19:23:39 +05:30
end
end
end
end