Giter VIP home page Giter VIP logo

qiita-rb's Introduction

Qiita

Gem Version Build Status

Qiita API v2 client library and CLI tool, written in Ruby.

Install

Note: requires Ruby 2.0.0 or higher.

gem install qiita

Library

require "qiita"

client = Qiita::Client.new(access_token: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd")
client.list_items
client.list_users
client.list_user_items("r7kamura")
client.get_user("r7kamura")
client.get_user("r7kamura").status
client.get_user("r7kamura").headers
client.get_user("r7kamura").body

CLI

qiita executable calls Qiita::Client's methods.

$ qiita <method> <arguments> [headers|params] [options]
           |          |          |      |         |
           |          |          |      |         `-- -H, --host
           |          |          |      |             -a, --access-token
           |          |          |      |             -c, --color
           |          |          |      |             -h, --help
           |          |          |      |                 --header
           |          |          |      |                 --no-body
           |          |          |      |                 --no-ssl-verification
           |          |          |      |             -t, --team
           |          |          |      |
           |          |          |      `------------ key=value or key:=value
           |          |          |
           |          |          `------------------- Key:value
           |          |
           |          `------------------------------ required arguments for the method
           |
           `----------------------------------------- method name

$ qiita list_users
$ qiita get_user r7kamura
$ qiita list_user_items r7kamura

Method and Arguments

Pass Qiita::Client method name and required arguments.

Access token

Accepts access token via -a, --access-token or QIITA_ACCESS_TOKEN environment variable.

Headers

To set custom request headers, use Key:value syntax.

$ qiita list_items "Authorization:Bearer 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd"

Params

Params are used for query string in GET method, or for request body in other methods. You can set params by key=value or key:=value syntax. key=value is parsed into String value, while key:=value is parsed into JSON value (e.g. key:=17 will be {"key":17}). qiita also accepts params via STDIN.

$ qiita list_items page=2 per_page=10
$ qiita create_item < params.json

qiita-rb's People

Contributors

kenju avatar kmrshntr avatar kyanny avatar mziyut avatar ongaeshi avatar r7kamura avatar sixeight avatar takano32 avatar tomykaira avatar uasi avatar yaotti avatar yujinakayama 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.