Class: Vk::Schema::Definition::Method

Inherits:
Constant show all
Includes:
HasAttributes
Defined in:
lib/vk/schema/definition/method.rb

Instance Attribute Summary

Attributes inherited from Constant

#name

Attributes inherited from Vk::Schema::Definition

#definition, #name, #schema

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasAttributes

#attributes, #properties, #required_attribute?

Methods inherited from Constant

#definition_file, #namespace, #referenced_type_name, #spec_file, #type_name

Methods inherited from Vk::Schema::Definition

#description, #to_s

Constructor Details

#initialize(name, definition, schema) ⇒ Method

Returns a new instance of Method.



14
15
16
17
18
# File 'lib/vk/schema/definition/method.rb', line 14

def initialize(name, definition, schema)
  super
  @original_method = @name
  @name = @name.underscore
end

Class Method Details

.namespace_splitterObject



10
11
12
# File 'lib/vk/schema/definition/method.rb', line 10

def self.namespace_splitter
  @namespace_splitter ||= /\./
end

Instance Method Details

#methodObject



25
26
27
# File 'lib/vk/schema/definition/method.rb', line 25

def method
  "'#{@namespace}.#{@original_method}'"
end

#openBoolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/vk/schema/definition/method.rb', line 34

def open
  definition['open'] ? :true : :false
end

#requireString

Returns:

  • (String)


21
22
23
# File 'lib/vk/schema/definition/method.rb', line 21

def require
  "vk/api/#{@namespace}/methods/#{@name}"
end

#response_classObject



29
30
31
# File 'lib/vk/schema/definition/method.rb', line 29

def response_class
  "Vk::API::#{namespace}::Responses::#{type_name}Response"
end