Procourse Membership API Endpoints

@blake, is there an interest in PR’s for plugin endpoints (Procourse Membership in this case), e.g.:

  def membership_subscriptions(user_id)
    response = get("/memberships/subscriptions/#{user_id}.json")
    response[:body]
  end

For the api gem? No I don’t think those should be in the core gem. I’m not sure yet about how to go about it, but I’ve thought about a way to include other gems that just add the endpoints for plugins.

I bet if you make a completely separate gem you could require the discourse_api gem and maybe use class_eval to add your methods?

7 Likes

class_eval seems to work great. Thanks, @blake.

def add_momentum_api_endpoints
 DiscourseApi::Client.class_eval do
   def membership_subscriptions(user_id)
     response = get("/memberships/subscriptions/#{user_id}.json")
     response[:body]
   end
 end
end
2 Likes