Giter VIP home page Giter VIP logo

mediumite's Introduction

Mediumite CircleCI

This is simple wrapper for the Medium API written in Ruby. For full API documentation, see Medium/medium-api-docs: Documentation for Medium's OAuth2 API

Usage

Authentication

In order to publish on behalf of a Medium account, you will need an access token. Medium offers two ways to acquire an access token: browser-based OAuth authentication, and self-issued access tokens. Currently this library supports only self-issued access tokens.

You can generate/revoke an access token from the Settings page of your Medium account.

Using the access token, initlize Mediumite::Client.

client = Mediumite::Client.new(token: your_access_token)

Resources

Users

Getting the authenticated user’s details

Returns details of the user who has granted permission to the application.

Example:

> client.user
=> {:id=>"5303d74c64f66366f00cb9b2a94f3251bf5",
  :username=>"majelbstoat",
  :name=>"Jamie Talbot",
  :url=>"https://medium.com/@majelbstoat",
  :imageUrl=>"https://images.medium.com/0*fkfQiTzT7TlUGGyI.png"}

Publications

Listing the user’s publications

Returns a full list of publications that the user is related to in some way: This includes all publications the user is subscribed to, writes to, or edits.

Example:

> client.get_publications
=> [{:id=>"b969ac62a46b",
  :name=>"About Medium",
  :description=>"What is this thing and how does it work?",
  :url=>"https://medium.com/about",
  :imageUrl=>"https://cdn-images-1.medium.com/fit/c/200/200/0*ae1jbP_od0W6EulE.jpeg"}
,
  {:id=>"b45573563f5a",
  :name=>"Developers",
  :description=>"Medium’s Developer resources",
  :url=>"https://medium.com/developers",
  :imageUrl=>"https://cdn-images-1.medium.com/fit/c/200/200/1*[email protected]"}
]

Posts

Creating a post

Creates a post on the authenticated user’s profile.

Example:

> post = Mediumite::Post.new(title: "Liverpool FC", body: "# Liverpool FC\nYou’ll never walk alone.")
> client.create_post(post)
=> {:id=>"e6f36a",
  :title=>"Liverpool FC",
  :authorId=>"5303d74c64f66366f00cb9b2a94f3251bf5",
  :url=>"https://medium.com/@majelbstoat/liverpool-fc-e6f36a",
  :canonicalUrl=>"http://jamietalbot.com/posts/liverpool-fc",
  :publishStatus=>"draft",
  :publishedAt=>1442286338435,
  :license=>"",
  :licenseUrl=>"https://medium.com/policy/9db0094a1e0f"
  :tags=>[]}

You can specify these parameters below.

Parameter Type Required? Description
title string required The title of the post. This is required if format == "html"
body string required The body of the post, in a valid, semantic, markdown or HTML fragment. Further markups may be supported in the future. For a full list of accepted HTML tags, see here.
format string optional The format of the "body" field. There are two valid values, "markdown", and "html". The default is "markdown"
publish_status string optional The status of the post. Valid values are “public”, “draft”, or “unlisted”. The default is “draft”.
tags string array optional Tags to classify the post. Only the first three will be used. Tags longer than 25 characters will be ignored.
publication_id string optional The publication id. The post will associate with the given publication.

mediumite's People

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.