Method: OneAndOne::User#api

Defined in:
lib/1and1/user.rb

#api(user_id: @id) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/1and1/user.rb', line 180

def api(user_id: @id)

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

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

  # 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