Class: DolphinKit::Service

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = 'youdao', client_id: nil, client_secret: nil, api_key: '') ⇒ Service

Returns a new instance of Service.



5
6
7
8
9
10
11
12
13
# File 'lib/dolphin_kit/service.rb', line 5

def initialize(name = 'youdao', client_id: nil, client_secret: nil, api_key: '')
  @name, @client_id, @client_secret = name.to_sym, client_id, client_secret

  if @client_id.nil? and @client_secret.nil?
    @client_id, @client_secret = api_key.split(':')
  end

  @instance = build_instance
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/dolphin_kit/service.rb', line 3

def name
  @name
end

Instance Method Details

#call(**args) ⇒ Object



15
16
17
# File 'lib/dolphin_kit/service.rb', line 15

def call(**args)
  @instance.call(**args)
end