Class: TreasureData::API::ToHashStruct

Inherits:
Struct
  • Object
show all
Extended by:
ClassModule
Defined in:
lib/td/client/api/to_hash_struct.rb

Defined Under Namespace

Modules: ClassModule

Instance Method Summary collapse

Methods included from ClassModule

from_hash, from_json, model, model_property, parse_json

Instance Method Details

#to_hObject



38
39
40
41
42
43
44
# File 'lib/td/client/api/to_hash_struct.rb', line 38

def to_h
  self.class.members.inject({}) { |r, e|
    v = obj_to_h(self[e])
    r[e.to_s] = v unless v.nil?
    r
  }
end

#to_jsonObject



46
47
48
# File 'lib/td/client/api/to_hash_struct.rb', line 46

def to_json
  to_h.to_json
end

#validateObject



50
51
52
53
54
55
56
# File 'lib/td/client/api/to_hash_struct.rb', line 50

def validate
  validate_self
  values.each do |v|
    v.validate if v.is_a?(ToHashStruct)
  end
  self
end

#validate_selfObject



58
59
60
# File 'lib/td/client/api/to_hash_struct.rb', line 58

def validate_self
  # define as required
end