Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simayosi/rb-msgraph-client

Simple Microsoft Graph client gem
https://github.com/simayosi/rb-msgraph-client

Last synced: about 1 month ago
JSON representation

Simple Microsoft Graph client gem

Awesome Lists containing this project

README

        

# MSGraph::Client

[![Gem Version](https://badge.fury.io/rb/msgraph-client.svg)](https://badge.fury.io/rb/msgraph-client)
![Ruby](https://github.com/simayosi/rb-msgraph-client/actions/workflows/test.yml/badge.svg)

A simple client library for Microsoft Graph.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'msgraph-client'
```

And then execute:

$ bundle install

Or install it yourself as:

$ gem install msgraph-client

## Getting started

To call Graph API using this library, you need an access token.
A choice for aquiring the access token is
[MSIDP::Endpoint](https://github.com/simayosi/rb-msidp-endpoint).

### Usage example
```ruby
require 'msgraph/client'

client = MSGraph::Client.new

# Aquire an access token and set it to `token`

endpoint = "/v1.0/users?$filter=startswith(givenName, 'J')&$top=5"
# For paging
while endpoint
response = client.request(:get, endpoint, token)
response[:value].each do |user|
# do something
end
# Next page
endpoint = response[MSGraph::NEXT_LINK_KEY]
end
```

## API Reference
[RubyDoc.info](https://rubydoc.info/gems/msgraph-client)

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).