Sha256: cfdd2447860d8e5684252ad0928cb52b7c8b07c8c35e70b3f807bd735310fb2e

Contents?: true

Size: 1.48 KB

Versions: 26

Compression:

Stored size: 1.48 KB

Contents

<% if cls.type == 'object' -%>

# <%= 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 %>`
  # @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

26 entries across 26 versions & 2 rubygems

Version Path
google-api-client-0.10.2 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.10.1 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.10.0 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.28 lib/google/apis/generator/templates/_class.tmpl
lemboy-google-api-client-0.9.26 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.26 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.25 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.24 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.23 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.22 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.21 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.20 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.19 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.18 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.15 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.14 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.13 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.12 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.11 lib/google/apis/generator/templates/_class.tmpl
google-api-client-0.9.9 lib/google/apis/generator/templates/_class.tmpl