Class: RecastAI::Client
- Inherits:
-
Object
- Object
- RecastAI::Client
- Defined in:
- lib/recastai.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token = nil, language = nil) ⇒ Client
constructor
A new instance of Client.
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
#language ⇒ Object (readonly)
Returns the value of attribute language.
16 17 18 |
# File 'lib/recastai.rb', line 16 def language @language end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
16 17 18 |
# File 'lib/recastai.rb', line 16 def token @token end |