Class: StopForumSpam::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/stop_forum_spam/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/stop_forum_spam/client.rb', line 9

def initialize(api_key=nil)
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



7
8
9
# File 'lib/stop_forum_spam/client.rb', line 7

def api_key
  @api_key
end

Instance Method Details

#get(options = {}) ⇒ Object



21
22
23
# File 'lib/stop_forum_spam/client.rb', line 21

def get(options={})
  self.class.get('/api', options)
end

#post(options = {}) ⇒ Object



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

def post(options={})
  self.class.post('/post.php', 
    :body => {:ip_addr => options[:ip_address], 
      :email=> options[:email], 
      :username => options[:username], 
      :api_key => api_key})
end