Class: Google::Apis::DiscoveryV1::JsonSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/google/apis/generator/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_refObject

Returns the value of attribute base_ref.



35
36
37
# File 'lib/google/apis/generator/model.rb', line 35

def base_ref
  @base_ref
end

#discriminantObject

Returns the value of attribute discriminant.



37
38
39
# File 'lib/google/apis/generator/model.rb', line 37

def discriminant
  @discriminant
end

#discriminant_valueObject

Returns the value of attribute discriminant_value.



38
39
40
# File 'lib/google/apis/generator/model.rb', line 38

def discriminant_value
  @discriminant_value
end

#generated_class_nameObject

Returns the value of attribute generated_class_name.



34
35
36
# File 'lib/google/apis/generator/model.rb', line 34

def generated_class_name
  @generated_class_name
end

#generated_nameObject

Returns the value of attribute generated_name.



33
34
35
# File 'lib/google/apis/generator/model.rb', line 33

def generated_name
  @generated_name
end

#nameObject

Returns the value of attribute name.



32
33
34
# File 'lib/google/apis/generator/model.rb', line 32

def name
  @name
end

#parentObject

Returns the value of attribute parent.



36
37
38
# File 'lib/google/apis/generator/model.rb', line 36

def parent
  @parent
end

#pathObject

Returns the value of attribute path.



39
40
41
# File 'lib/google/apis/generator/model.rb', line 39

def path
  @path
end

Instance Method Details

#generated_typeObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/google/apis/generator/model.rb', line 49

def generated_type
  case type
  when 'string', 'boolean', 'number', 'integer', 'any'
    return 'DateTime' if format == 'date-time'
    return 'Date' if format == 'date'
    return 'Fixnum' if format == 'int64'
    return 'Fixnum' if format == 'uint64'
    return TYPE_MAP[type]
  when 'array'
    if items == self
      return sprintf('Array<%s>', qualified_name)
    end
    return sprintf('Array<%s>', items.generated_type)
  when 'hash'
    if additional_properties == self
      return sprintf('Hash<String,%s>', qualified_name)
    end
    return sprintf('Hash<String,%s>', additional_properties.generated_type)
  when 'object'
    return qualified_name
  end
end

#propertiesObject



41
42
43
# File 'lib/google/apis/generator/model.rb', line 41

def properties
  Hash[(@properties || {}).sort]
end

#qualified_nameObject



45
46
47
# File 'lib/google/apis/generator/model.rb', line 45

def qualified_name
  parent.qualified_name + '::' + generated_class_name
end