Class: UniSender::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, locale = nil) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
17
18
# File 'lib/uni_sender.rb', line 10

def initialize(api_key, locale = nil)
  self.api_key = api_key

  if locale.is_a?(Hash)
    puts "Deprecated: Initializer changed. Use UniSender::Client.new(api_key, [locale])"
    locale = locale[:locale]
  end
  self.locale = locale if locale
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



26
27
28
29
# File 'lib/uni_sender.rb', line 26

def method_missing(method_name, *args, &block)
  params = (args.first.is_a?(Hash) ? args.first : {} )
  default_request(prepare_action_name(method_name), params)
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



8
9
10
# File 'lib/uni_sender.rb', line 8

def api_key
  @api_key
end

#localeObject

Returns the value of attribute locale.



8
9
10
# File 'lib/uni_sender.rb', line 8

def locale
  @locale
end