app/models/user.rb
# After attributes rvs_email and rvs_password are set, call this method to get the rvs api_key
After attributes rvs_email and rvs_password are set, call this method to get the rvs api_key
After attributes rvs_email and rvs_password are set call this method to get the rvs api_key
def rvs_get_key
    return false unless rvs_email && rvs_password
    resp = rvs_connection.post('/api-keys', email: rvs_email, password: rvs_password)
    return false unless resp.status == 201
    update_column :rvs_key, JSON.parse(resp.body)['access_token']
    update_column :rvs_id,  JSON.parse(resp.body)['user']['id']
    return true
  end
def rvs_get_key return false unless rvs_email && rvs_password resp = rvs_connection . post ( '/api-keys' , email : rvs_email , password : rvs_password ) return false unless resp . status == 201 update_column :rvs_key , JSON . parse ( resp . body ) [ 'access_token' ] update_column :rvs_id , JSON . parse ( resp . body ) [ 'user' ] [ 'id' ] return true end
After attributes rvs_email and rvs_password are set, call this method to get the rvs api_key
After attributes rvs_email and rvs_password are set call this method to get the rvs api_key