Sha256: 9096d04eebe53da681cd4ce4ebfa6db59bc97d39dba7abc9383298a31814fd1c

Contents?: true

Size: 1.66 KB

Versions: 132

Compression:

Stored size: 1.66 KB

Contents

<% if cls.type == 'object' || (cls.type == 'hash' && cls.properties.length > 0) -%>

# <%= block_comment(cls.description, 0, 1) %>
class <%= cls.generated_class_name %><% if cls.base_ref %> < <%= cls.base_ref.generated_type %><% end %>
  include Google::Apis::Core::Hashable
<%   for property in cls.properties.values -%>

  # <%= block_comment(property.description, 2, 1) %>
  # Corresponds to the JSON property `<%= property.name %>`
<% if property.format == 'byte' -%>
  # NOTE: Values are automatically base64 encoded/decoded in the client library.
<% end -%>
  # @return [<%= property.generated_type %>]
  attr_accessor :<%= property.generated_name %>
<%     if property.type == 'boolean' -%>
  alias_method :<%= property.generated_name %>?, :<%= property.generated_name %>
<%     end -%>
<%   end -%>

  def initialize(**args)
<%   if cls.discriminant -%>
    @<%= cls.properties[cls.discriminant].generated_name %> = '<%= cls.discriminant_value %>'
<%   end -%>
     update!(**args)
  end

  # Update properties of this object
  def update!(**args)
<%   for property in cls.properties.values -%>
    @<%= property.generated_name %> = args[:<%= property.generated_name %>] if args.key?(:<%= property.generated_name %>)
<%   end -%>
  end
<%   for child_class in cls.properties.values -%>
<%     if child_class._ref.nil? -%>
<%= indent(include('class', :cls => child_class, :api => api), 2) -%>
<%     end -%>
<%   end -%>
end
<% elsif cls.items && cls.items._ref.nil? -%>
<%= include('class', :cls => cls.items, :api => api) -%>
<% elsif cls.additional_properties && cls.additional_properties._ref.nil? -%>
<%= include('class', :cls => cls.additional_properties, :api => api) -%>
<% end -%>

Version data entries

132 entries across 132 versions & 3 rubygems

Version Path
google-apis-generator-0.15.1 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.14.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.13.1 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.13.0 lib/google/apis/generator/templates/_class.tmpl
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/google-apis-generator-0.12.0/lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.12.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.11.1 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.11.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.10.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.9.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.8.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.7.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.6.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.5.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.4.1 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.4.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.3.0 lib/google/apis/generator/templates/_class.tmpl
google-apis-generator-0.2.0 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.52.0 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.51.0 lib/google/apis/generator/templates/_class.tmpl