Class: RecastAI::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/recastai.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = nil, language = nil) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
# File 'lib/recastai.rb', line 18

def initialize(token = nil, language = nil)
  [RecastAI::Request, RecastAI::Connect, RecastAI::Build].each do |api|
    i = api.name.rindex('::')
    name = i.nil? ? api.name : api.name[(i + 2)..-1]

    self.class.send(:define_method, name.downcase.to_sym, ->{ api.new(token, language) })
  end
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



16
17
18
# File 'lib/recastai.rb', line 16

def language
  @language
end

#tokenObject (readonly)

Returns the value of attribute token.



16
17
18
# File 'lib/recastai.rb', line 16

def token
  @token
end