Class: ApimaticApi::UserCodeGeneration

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/apimatic_api/models/user_code_generation.rb

Overview

The Code Generation structure encapsulates all the the details of an SDK generation performed by a user.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id:, template: Platforms::CS_NET_STANDARD_LIB, generated_file:, generated_on:, hash_code:, code_generation_source:, code_gen_version:, success:, user_id:, input_file:, additional_properties: nil) ⇒ UserCodeGeneration

Returns a new instance of UserCodeGeneration.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/apimatic_api/models/user_code_generation.rb', line 81

def initialize(id:, template: Platforms::CS_NET_STANDARD_LIB,
               generated_file:, generated_on:, hash_code:,
               code_generation_source:, code_gen_version:, success:,
               user_id:, input_file:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @template = template
  @generated_file = generated_file
  @generated_on = generated_on
  @hash_code = hash_code
  @code_generation_source = code_generation_source
  @code_gen_version = code_gen_version
  @success = success
  @user_id = user_id
  @input_file = input_file
  @additional_properties = additional_properties
end

Instance Attribute Details

#code_gen_versionString

Generation Version

Returns:

  • (String)


41
42
43
# File 'lib/apimatic_api/models/user_code_generation.rb', line 41

def code_gen_version
  @code_gen_version
end

#code_generation_sourceString

Generation Source

Returns:

  • (String)


37
38
39
# File 'lib/apimatic_api/models/user_code_generation.rb', line 37

def code_generation_source
  @code_generation_source
end

#generated_fileString

The generated SDK

Returns:

  • (String)


25
26
27
# File 'lib/apimatic_api/models/user_code_generation.rb', line 25

def generated_file
  @generated_file
end

#generated_onDateTime

Generation Date and Time

Returns:

  • (DateTime)


29
30
31
# File 'lib/apimatic_api/models/user_code_generation.rb', line 29

def generated_on
  @generated_on
end

#hash_codeString

The md5 hash of the API Description

Returns:

  • (String)


33
34
35
# File 'lib/apimatic_api/models/user_code_generation.rb', line 33

def hash_code
  @hash_code
end

#idString

Unique Code Generation Identifier

Returns:

  • (String)


16
17
18
# File 'lib/apimatic_api/models/user_code_generation.rb', line 16

def id
  @id
end

#input_fileString

API Specification file in a supported format

Returns:

  • (String)


53
54
55
# File 'lib/apimatic_api/models/user_code_generation.rb', line 53

def input_file
  @input_file
end

#successTrueClass | FalseClass

Generation Status

Returns:

  • (TrueClass | FalseClass)


45
46
47
# File 'lib/apimatic_api/models/user_code_generation.rb', line 45

def success
  @success
end

#templatePlatforms

The structure contains platforms that APIMatic CodeGen can generate SDKs and Docs in.

Returns:



21
22
23
# File 'lib/apimatic_api/models/user_code_generation.rb', line 21

def template
  @template
end

#user_idString

Unique User Identifier

Returns:

  • (String)


49
50
51
# File 'lib/apimatic_api/models/user_code_generation.rb', line 49

def user_id
  @user_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/apimatic_api/models/user_code_generation.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  template = hash['template'] ||= Platforms::CS_NET_STANDARD_LIB
  generated_file = hash.key?('generatedFile') ? hash['generatedFile'] : nil
  generated_on = if hash.key?('generatedOn')
                   (DateTimeHelper.from_rfc3339(hash['generatedOn']) if hash['generatedOn'])
                 end
  hash_code = hash.key?('hashCode') ? hash['hashCode'] : nil
  code_generation_source =
    hash.key?('codeGenerationSource') ? hash['codeGenerationSource'] : nil
  code_gen_version =
    hash.key?('codeGenVersion') ? hash['codeGenVersion'] : nil
  success = hash.key?('success') ? hash['success'] : nil
  user_id = hash.key?('userId') ? hash['userId'] : nil
  input_file = hash.key?('inputFile') ? hash['inputFile'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UserCodeGeneration.new(id: id,
                         template: template,
                         generated_file: generated_file,
                         generated_on: generated_on,
                         hash_code: hash_code,
                         code_generation_source: code_generation_source,
                         code_gen_version: code_gen_version,
                         success: success,
                         user_id: user_id,
                         input_file: input_file,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/apimatic_api/models/user_code_generation.rb', line 56

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['template'] = 'template'
  @_hash['generated_file'] = 'generatedFile'
  @_hash['generated_on'] = 'generatedOn'
  @_hash['hash_code'] = 'hashCode'
  @_hash['code_generation_source'] = 'codeGenerationSource'
  @_hash['code_gen_version'] = 'codeGenVersion'
  @_hash['success'] = 'success'
  @_hash['user_id'] = 'userId'
  @_hash['input_file'] = 'inputFile'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
# File 'lib/apimatic_api/models/user_code_generation.rb', line 77

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
# File 'lib/apimatic_api/models/user_code_generation.rb', line 72

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
164
165
# File 'lib/apimatic_api/models/user_code_generation.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, template: #{@template.inspect}, generated_file:"\
  " #{@generated_file.inspect}, generated_on: #{@generated_on.inspect}, hash_code:"\
  " #{@hash_code.inspect}, code_generation_source: #{@code_generation_source.inspect},"\
  " code_gen_version: #{@code_gen_version.inspect}, success: #{@success.inspect}, user_id:"\
  " #{@user_id.inspect}, input_file: #{@input_file.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_generated_onObject



142
143
144
# File 'lib/apimatic_api/models/user_code_generation.rb', line 142

def to_custom_generated_on
  DateTimeHelper.to_rfc3339(generated_on)
end

#to_sObject

Provides a human-readable string representation of the object.



147
148
149
150
151
152
153
154
# File 'lib/apimatic_api/models/user_code_generation.rb', line 147

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, template: #{@template}, generated_file: #{@generated_file},"\
  " generated_on: #{@generated_on}, hash_code: #{@hash_code}, code_generation_source:"\
  " #{@code_generation_source}, code_gen_version: #{@code_gen_version}, success: #{@success},"\
  " user_id: #{@user_id}, input_file: #{@input_file}, additional_properties:"\
  " #{@additional_properties}>"
end