Class: Libfchat::WebAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ticketObject (readonly)

Returns the value of attribute ticket.



11
12
13
# File 'lib/libfchat/webapi.rb', line 11

def ticket
  @ticket
end

Instance Method Details

#get_ticket(account, password) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/libfchat/webapi.rb', line 13

def get_ticket(,password)
  uri = URI('http://www.f-list.net/json/getApiTicket.php')
  res = Net::HTTP.post_form(uri,
                            'account' => ,
                            'password' => password)

  json = MultiJson.load(res.body)
  if json['ticket']
    @ticket = json['ticket']
  else
    raise json['error']
  end
  return json
end