Sha256: a606a86ffe997876211af05a104c0be9151c3d29fcaccca5f37141429e9dcb85

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true

require 'avm/eac_gitlab_base0/api/base_entity'
require 'eac_rest/api'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacGitlabBase0
    class Api < ::EacRest::Api
      class File < ::Avm::EacGitlabBase0::Api::BaseEntity
        FIELDS = %w[file_name file_path size encoding content_sha256 ref blob_id commit_id
                    last_commit_id].freeze

        FIELDS.each do |field|
          define_method field do
            data.fetch(field)
          end
        end

        def content
          case encoding
          when 'base64' then ::Base64.decode64(encoded_content)
          else nyi("Unmapped encoding: #{encoding}")
          end
        end

        def encoded_content
          data.fetch('content')
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
eac_tools-0.84.0 sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb
eac_tools-0.83.0 sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb
eac_tools-0.82.0 sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb
avm-eac_gitlab_base0-0.4.0 lib/avm/eac_gitlab_base0/api/file.rb
eac_tools-0.81.0 sub/avm-eac_gitlab_base0/lib/avm/eac_gitlab_base0/api/file.rb
avm-eac_gitlab_base0-0.3.0 lib/avm/eac_gitlab_base0/api/file.rb