Class: Rets::Metadata::RetsObject

Inherits:
Object
  • Object
show all
Defined in:
lib/rets/metadata/rets_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name, mime_type, description) ⇒ RetsObject

Returns a new instance of RetsObject.



6
7
8
9
10
11
# File 'lib/rets/metadata/rets_object.rb', line 6

def initialize(type, name, mime_type, description)
  @name = name
  @mime_type = mime_type
  @description = description
  @type = type
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/rets/metadata/rets_object.rb', line 4

def description
  @description
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



4
5
6
# File 'lib/rets/metadata/rets_object.rb', line 4

def mime_type
  @mime_type
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rets/metadata/rets_object.rb', line 4

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/rets/metadata/rets_object.rb', line 4

def type
  @type
end

Class Method Details

.build(rets_object_fragment) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rets/metadata/rets_object.rb', line 13

def self.build(rets_object_fragment)
  rets_object_fragment = downcase_hash_keys(rets_object_fragment)
  name = rets_object_fragment["visiblename"]
  mime_type = rets_object_fragment["mimetype"]
  description = rets_object_fragment["description"]
  type = rets_object_fragment['objecttype']
  new(type, name, mime_type, description)
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
32
33
# File 'lib/rets/metadata/rets_object.rb', line 29

def ==(other)
  name == other.name &&
    mime_type == other.mime_type &&
    description == other.description
end


22
23
24
25
26
27
# File 'lib/rets/metadata/rets_object.rb', line 22

def print_tree(out = $stdout)
  out.puts "  Object: #{type}"
  out.puts "    Visible Name: #{name}"
  out.puts "    Mime Type: #{mime_type}"
  out.puts "    Description: #{description}"
end