Class: Flutterwave::IP

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ IP

Returns a new instance of IP.



5
6
7
# File 'lib/flutterwave/ip.rb', line 5

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



3
4
5
# File 'lib/flutterwave/ip.rb', line 3

def client
  @client
end

Instance Method Details

#check(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/flutterwave/ip.rb', line 9

def check(options = {})
  raise Flutterwave::Utils::MissingKeyError.new(
    'IP key required!'
  ) unless options[:ip]

  response = post(
    Flutterwave::Utils::Constants::IP[:check_url],
    ip: options[:ip]
  )

  Flutterwave::Response.new(response)
end

#post(url, data) ⇒ Object



22
23
24
# File 'lib/flutterwave/ip.rb', line 22

def post(url, data)
  Flutterwave::Utils::NetworkManager.post(url, data)
end