Class: Maxmind::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Request

Returns a new instance of Request.



20
21
22
# File 'lib/maxmind/request.rb', line 20

def initialize(attrs={}) 
  self.attributes = attrs
end

Instance Attribute Details

#accept_languageObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def accept_language
  @accept_language
end

#binObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def bin
  @bin
end

#bin_nameObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def bin_name
  @bin_name
end

#bin_phoneObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def bin_phone
  @bin_phone
end

#cityObject

Required Fields



12
13
14
# File 'lib/maxmind/request.rb', line 12

def city
  @city
end

#client_ipObject

Required Fields



12
13
14
# File 'lib/maxmind/request.rb', line 12

def client_ip
  @client_ip
end

#countryObject

Required Fields



12
13
14
# File 'lib/maxmind/request.rb', line 12

def country
  @country
end

#cust_phoneObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def cust_phone
  @cust_phone
end

#domainObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def domain
  @domain
end

#emailObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def email
  @email
end

#forwarded_ipObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def forwarded_ip
  @forwarded_ip
end

#passwordObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def password
  @password
end

#postalObject

Required Fields



12
13
14
# File 'lib/maxmind/request.rb', line 12

def postal
  @postal
end

#regionObject

Required Fields



12
13
14
# File 'lib/maxmind/request.rb', line 12

def region
  @region
end

#request_typeObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def request_type
  @request_type
end

#session_idObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def session_id
  @session_id
end

#shipping_addressObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def shipping_address
  @shipping_address
end

#shipping_cityObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def shipping_city
  @shipping_city
end

#shipping_countryObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def shipping_country
  @shipping_country
end

#shipping_postalObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def shipping_postal
  @shipping_postal
end

#shipping_regionObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def shipping_region
  @shipping_region
end

#transaction_idObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def transaction_id
  @transaction_id
end

#user_agentObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def user_agent
  @user_agent
end

#usernameObject

Optional Fields



15
16
17
# File 'lib/maxmind/request.rb', line 15

def username
  @username
end

Instance Method Details

#attributes=(attrs = {}) ⇒ Object



25
26
27
28
29
# File 'lib/maxmind/request.rb', line 25

def attributes=(attrs={})
  attrs.each do |k, v|
    self.send("#{k}=", v)
  end
end

#processObject



67
68
69
70
71
# File 'lib/maxmind/request.rb', line 67

def process
  process!
rescue Exception => e
  false
end

#process!Object



62
63
64
65
# File 'lib/maxmind/request.rb', line 62

def process!
  resp = post(query)
  Maxmind::Response.new(resp)
end