Class: Vk::Schema::Definition::Response
Instance Attribute Summary
Attributes inherited from Constant
#name
#definition, #name, #schema
Instance Method Summary
collapse
#attributes, #properties, #required_attribute?
Methods inherited from Constant
#definition_file, #namespace, namespace_splitter, #referenced_type_name, #spec_file, #type_name
#description, #to_s
Constructor Details
#initialize(name, definition, schema) ⇒ Response
Returns a new instance of Response.
13
14
15
16
17
18
|
# File 'lib/vk/schema/definition/response.rb', line 13
def initialize(name, definition, schema)
super
@request, @name = @name.split(/_/, 2)
@request = @request.underscore
@name = "#{@request}_response"
end
|
Instance Method Details
#additional_properties? ⇒ Boolean
42
43
44
|
# File 'lib/vk/schema/definition/response.rb', line 42
def additional_properties?
definition['additionalProperties']
end
|
#parent ⇒ String
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/vk/schema/definition/response.rb', line 31
def parent
if definition['type'] == 'object'
'Vk::Schema::Response'
else
reference = definition['allOf'].detect do |definition|
definition['$ref']
end
schema.definition_of(reference['$ref']).referenced_type_name
end
end
|
#request ⇒ String
21
22
23
|
# File 'lib/vk/schema/definition/response.rb', line 21
def request
@request.camelize
end
|
#require ⇒ String
26
27
28
|
# File 'lib/vk/schema/definition/response.rb', line 26
def require
"vk/api/#{@namespace}/responses/#{@name}"
end
|