Class: Zoho::Client
- Inherits:
-
Object
- Object
- Zoho::Client
- Defined in:
- lib/zoho/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#ticket ⇒ Object
Returns the value of attribute ticket.
Instance Method Summary collapse
-
#initialize(params) ⇒ Client
constructor
A new instance of Client.
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'] login_resp = RestClient.post("https://accounts.zoho.com/login", params) split_arr = login_resp.split(/\n|\=/) ticket_index = split_arr.index('TICKET') + 1 @ticket = split_arr[ticket_index] end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/zoho/client.rb', line 3 def api_key @api_key end |
#ticket ⇒ Object
Returns the value of attribute ticket.
3 4 5 |
# File 'lib/zoho/client.rb', line 3 def ticket @ticket end |