Giter Club home page Giter Club logo

discourse_api's Introduction

DiscourseApi

Code Climate

The Discourse API gem allows you to consume the Discourse API

Installation

Add this line to your application's Gemfile:

gem 'discourse_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install discourse_api

Usage

Over time this project intends to have a full Discourse API. At the moment there are only a few endpoints available:

client = DiscourseApi::Client.new("http://try.discourse.org")
client.api_key = "YOUR_API_KEY"
client.api_username = "YOUR_USERNAME"

client.ssl(...)                                 #=> specify SSL connection settings if needed

# Topic endpoints
client.latest_topics                            #=> Gets a list of the latest topics
client.hot_topics                               #=> Gets a list of hot topics
client.new_topics                               #=> Gets a list of new topics
client.topics_by("sam")                         #=> Gets a list of topics created by user "sam"
client.topic(57)                                #=> Gets the topic with id 57

# Search endpoint
client.search("sandbox")                        #=> Gets a list of topics that match "sandbox"

# Categories endpoint
client.categories                               #=> Gets a list of categories
client.category_latest_posts("category-slug")   #=> Gets a list of latest posts in a category

# SSO endpoint
client.sync_sso(                                #=> Synchronizes the SSO record
  sso_secret: "discourse_sso_rocks",
  name: "Test Name",
  username: "test_name",
  email: "[email protected]",
  external_id: "2"
)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Testing

  1. Install discourse locally
  2. Inside of your discourse directory, run: bundle exec rake db:api_test_seed
  3. Start discourse: bundle exec rails s
  4. Inside of your discourse_api directory, run: bundle exec rspec spec/

discourse_api's People

Contributors

arpitjalan avatar bywallace avatar cgagon avatar coding-horror avatar dansingerman avatar dasnixon avatar davidsantoso avatar emaillenin avatar eviltrout avatar jamesfid avatar jhilden avatar jmay avatar johnpaulashenfelter avatar kennym avatar leonardteo avatar maclover7 avatar michaelherold avatar nlalonde avatar oblakeerickson avatar pda avatar samsaffron avatar scotterc avatar simpl1g avatar skx avatar spaghetticode avatar steventen avatar tmancino avatar unmanbearpig avatar woto avatar zogstrip avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.