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, params = {}) ⇒ Client

Returns a new instance of Client.



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

def initialize(api_key, params={})
  self.api_key = api_key
  params.each do |key, value|
    if defined?("#{key}=")
      self.send("#{key}=", value)
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



46
47
48
49
# File 'lib/uni_sender.rb', line 46

def method_missing(undefined_action, *args, &block)
  params = (args.first.is_a?(Hash) ? args.first : {} )
  default_request(undefined_action.to_s.camelize(false), params)
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



10
11
12
# File 'lib/uni_sender.rb', line 10

def api_key
  @api_key
end

#client_ipObject

Returns the value of attribute client_ip.



10
11
12
# File 'lib/uni_sender.rb', line 10

def client_ip
  @client_ip
end

#localeObject

Returns the value of attribute locale.



10
11
12
# File 'lib/uni_sender.rb', line 10

def locale
  @locale
end