class Nri::FeatureInterest::Admin

Public Class Methods

new(origin) click to toggle source
# File lib/nri/feature_interest/admin.rb, line 8
def initialize(origin)
  @origin = URI(origin)
  @http = Net::HTTP.new(@origin.host, @origin.port)
end

Public Instance Methods

get_features_admin(authorization:) click to toggle source
# File lib/nri/feature_interest/admin.rb, line 13
def get_features_admin(authorization:)
  uri = URI("#{@origin}/features/admin")

  req = Net::HTTP::Get.new(uri)
  req["Authorization"] = authorization

  @http.request(req)
end
post_features(body:, authorization:) click to toggle source
# File lib/nri/feature_interest/admin.rb, line 22
def post_features(body:, authorization:)
  uri = URI("#{@origin}/features")

  req = Net::HTTP::Post.new(uri)
  req["Content-Type"] = "application/json"
  req["Authorization"] = authorization

  @http.request(req, body)
end
put_features_by_feature_id(feature_id, body:, authorization:) click to toggle source
# File lib/nri/feature_interest/admin.rb, line 32
def put_features_by_feature_id(feature_id, body:, authorization:)
  uri = URI("#{@origin}/features/#{feature_id}")

  req = Net::HTTP::Put.new(uri)
  req["Content-Type"] = "application/json"
  req["Authorization"] = authorization

  @http.request(req, body)
end