Class: Zoho::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/zoho/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/zoho/client.rb', line 4

def initialize(params)
  nil_params = [:LOGIN_ID, :PASSWORD, :servicename] - params.keys
  if nil_params.size != 0
    raise "#{nil_params.join(', ')} are nil"
  end
  @api_key = params['key']
   = RestClient.post("https://accounts.zoho.com/login", params)
  split_arr = .split(/\n|\=/)
  ticket_index = split_arr.index('TICKET') + 1
  @ticket = split_arr[ticket_index]
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/zoho/client.rb', line 3

def api_key
  @api_key
end

#ticketObject

Returns the value of attribute ticket.



3
4
5
# File 'lib/zoho/client.rb', line 3

def ticket
  @ticket
end