Class: DaggerRuby::File

Inherits:
DaggerObject show all
Defined in:
lib/dagger_ruby/file.rb

Instance Attribute Summary

Attributes inherited from DaggerObject

#client, #query_builder

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DaggerObject

#chain_operation, #id, #initialize

Constructor Details

This class inherits a constructor from DaggerRuby::DaggerObject

Class Method Details

.from_id(id, client) ⇒ Object



7
8
9
10
11
# File 'lib/dagger_ruby/file.rb', line 7

def self.from_id(id, client)
  query = QueryBuilder.new("file")
  query.load_from_id(id)
  new(query, client)
end

.root_field_nameObject



13
14
15
# File 'lib/dagger_ruby/file.rb', line 13

def self.root_field_name
  "file"
end

Instance Method Details

#contentsObject



33
34
35
# File 'lib/dagger_ruby/file.rb', line 33

def contents
  get_scalar("contents")
end

#export(path, opts = {}) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/dagger_ruby/file.rb', line 45

def export(path, opts = {})
  args = { "path" => path }
  args["allowParentDirPath"] = opts[:allow_parent_dir_path] if opts.key?(:allow_parent_dir_path)

  query = @query_builder.build_query_with_selection("export(#{format_arguments(args)})")
  result = @client.execute(query)
  extract_value_from_result(result, "export")
end

#nameObject



41
42
43
# File 'lib/dagger_ruby/file.rb', line 41

def name
  get_scalar("name")
end

#sizeObject



37
38
39
# File 'lib/dagger_ruby/file.rb', line 37

def size
  get_scalar("size")
end

#syncObject



54
55
56
57
# File 'lib/dagger_ruby/file.rb', line 54

def sync
  get_scalar("id")
  self
end

#with_contents(contents) ⇒ Object



21
22
23
# File 'lib/dagger_ruby/file.rb', line 21

def with_contents(contents)
  chain_operation("withContents", { "contents" => contents })
end

#with_name(name) ⇒ Object



17
18
19
# File 'lib/dagger_ruby/file.rb', line 17

def with_name(name)
  chain_operation("withName", { "name" => name })
end

#with_secret(secret) ⇒ Object



29
30
31
# File 'lib/dagger_ruby/file.rb', line 29

def with_secret(secret)
  chain_operation("withSecret", { "secret" => secret })
end

#with_timestamps(timestamp) ⇒ Object



25
26
27
# File 'lib/dagger_ruby/file.rb', line 25

def with_timestamps(timestamp)
  chain_operation("withTimestamps", { "timestamp" => timestamp })
end