Method: OneAndOne::User#api_key

Defined in:
lib/1and1/user.rb

#api_key(user_id: @id) ⇒ Object



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/1and1/user.rb', line 233

def api_key(user_id: @id)

  # If user passed in user ID, reassign
  @id = user_id

  # Build URL
  path = OneAndOne.build_url("/users/#{@id}/api/key")

  # Perform request
  response = @connection.request(:method => :get,
    :path => path,
    :headers => $header)

  # Check response status
  OneAndOne.check_response(response.body, response.status)

  #JSON-ify the response string
  JSON.parse(response.body)

end