Class: Comet::SearchResultFileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/search_result_file_info.rb

Overview

Vault snapshot.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSearchResultFileInfo

Returns a new instance of SearchResultFileInfo.



54
55
56
# File 'lib/comet/models/search_result_file_info.rb', line 54

def initialize
  clear
end

Instance Attribute Details

#access_timeObject

Timestamp in RFC3339 format with subsecond precision and time zone offset. See the Golang time.RFC3339Nano for more information.



40
41
42
# File 'lib/comet/models/search_result_file_info.rb', line 40

def access_time
  @access_time
end

#change_timeObject

Timestamp in RFC3339 format with subsecond precision and time zone offset. See the Golang time.RFC3339Nano for more information.



45
46
47
# File 'lib/comet/models/search_result_file_info.rb', line 45

def change_time
  @change_time
end

#mod_timeObject

Timestamp in RFC3339 format with subsecond precision and time zone offset. See the Golang time.RFC3339Nano for more information.



35
36
37
# File 'lib/comet/models/search_result_file_info.rb', line 35

def mod_time
  @mod_time
end

#modeObject

Returns the value of attribute mode.



30
31
32
# File 'lib/comet/models/search_result_file_info.rb', line 30

def mode
  @mode
end

#nameObject

Filename



23
24
25
# File 'lib/comet/models/search_result_file_info.rb', line 23

def name
  @name
end

#pathObject

Path to the file within the selected snapshot, using forwardslash (/) separators



19
20
21
# File 'lib/comet/models/search_result_file_info.rb', line 19

def path
  @path
end

#sizeObject

Bytes



49
50
51
# File 'lib/comet/models/search_result_file_info.rb', line 49

def size
  @size
end

#typeObject

One of the STOREDOBJECTTYPE_ constants



27
28
29
# File 'lib/comet/models/search_result_file_info.rb', line 27

def type
  @type
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



52
53
54
# File 'lib/comet/models/search_result_file_info.rb', line 52

def unknown_json_fields
  @unknown_json_fields
end

Instance Method Details

#clearObject



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/comet/models/search_result_file_info.rb', line 58

def clear
  @path = ''
  @name = ''
  @type = ''
  @mode = ''
  @mod_time = ''
  @access_time = ''
  @change_time = ''
  @size = 0
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/comet/models/search_result_file_info.rb', line 78

def from_hash(obj)
  raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash

  obj.each do |k, v|
    case k
    when 'path'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @path = v
    when 'name'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @name = v
    when 'type'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @type = v
    when 'mode'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @mode = v
    when 'mtime'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @mod_time = v
    when 'atime'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @access_time = v
    when 'ctime'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @change_time = v
    when 'size'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @size = v
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


71
72
73
74
75
# File 'lib/comet/models/search_result_file_info.rb', line 71

def from_json(json_string)
  raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String

  from_hash(JSON.parse(json_string))
end

#to_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



149
150
151
# File 'lib/comet/models/search_result_file_info.rb', line 149

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/comet/models/search_result_file_info.rb', line 122

def to_hash
  ret = {}
  ret['path'] = @path
  ret['name'] = @name
  ret['type'] = @type
  unless @mode.nil?
    ret['mode'] = @mode
  end
  unless @mod_time.nil?
    ret['mtime'] = @mod_time
  end
  unless @access_time.nil?
    ret['atime'] = @access_time
  end
  unless @change_time.nil?
    ret['ctime'] = @change_time
  end
  unless @size.nil?
    ret['size'] = @size
  end
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end

#to_json(options = {}) ⇒ String

Returns The complete object as a JSON string.

Returns:

  • (String)

    The complete object as a JSON string



154
155
156
# File 'lib/comet/models/search_result_file_info.rb', line 154

def to_json(options = {})
  to_hash.to_json(options)
end