Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit e3c1285

Browse files
author
Caitlin Bales (MSFT)
committed
Update README to include new usage example
1 parent f369ddf commit e3c1285

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
This client library is a release candidate and is still in preview status, please continue to provide [feedback](https://github.com/microsoftgraph/msgraph-sdk-ruby/issues/new) as we iterate towards a production supported library.
44

55
## Installation
6-
6+
run ```gem install microsoft_graph``` or include ```gem microsoft_graph``` in your gemfile.
77
## Getting started
88

99
### Register your application
1010

1111
Register your application to use Microsoft Graph API using one of the following
1212
supported authentication portals:
1313

14-
* [Microsoft Application Registration Portal](https://apps.dev.microsoft.com):
14+
* [Microsoft Application Registration Portal](https://apps.dev.microsoft.com) (**Recommended**):
1515
Register a new application that authenticates using the v2.0 authentication endpoint. This endpoint autthenticates both personal (Microsoft) and work or school (Azure Active Directory) accounts.
1616
* [Microsoft Azure Active Directory](https://manage.windowsazure.com): Register
1717
a new application in your tenant's Active Directory to support work or school
@@ -42,15 +42,13 @@ client_cred = ADAL::ClientCredential.new(client_id, client_secret)
4242
context = ADAL::AuthenticationContext.new(ADAL::Authority::WORLD_WIDE_AUTHORITY, tenant)
4343
tokens = context.acquire_token_for_user(resource, client_cred, user_cred)
4444

45-
# connect to the API and create the classes (most of this should be defaulted later)
46-
service = OData::Service.new(
47-
base_url: "https://graph.microsoft.com/v1.0/",
48-
namespace: "microsoft.graph",
49-
metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, "metadata_v1.0.xml"),
50-
auth_token: tokens.access_token,
51-
)
45+
# add the access token to the request header
46+
callback = Proc.new { |r| r.headers["Authorization"] = "Bearer #{tokens.access_token}"
5247

53-
graph = MicrosoftGraph.new(service)
48+
graph = MicrosoftGraph.new(
49+
base_url: "https://graph.microsoft.com/v1.0",
50+
&callback
51+
)
5452

5553
me = graph.me # get the current user
5654
puts "Hello, I am #{me.display_name}."
@@ -62,9 +60,6 @@ end
6260

6361
## Development
6462

65-
gem install bundler
66-
bundle install
67-
6863
### Running Tests
6964

7065
#### Unit Tests

microsoft_graph-0.1.0.gem

28 KB
Binary file not shown.

microsoft_graph.gemspec

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,8 @@ Gem::Specification.new do |spec|
99
spec.authors = ["Katie Miller", "Neal Lindsay"]
1010
spec.email = ["katie@testdouble.com", "neal@testdouble.com"]
1111

12-
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
13-
spec.description = %q{TODO: Write a longer description or delete this line.}
14-
spec.homepage = "TODO: Put your gem's website or public repo URL here."
15-
16-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17-
# delete this section to allow pushing this gem to any host.
18-
if spec.respond_to?(:metadata)
19-
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20-
else
21-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22-
end
12+
spec.summary = "Ruby SDK for Microsoft Graph"
13+
spec.homepage = "https://graph.microsoft.io"
2314

2415
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
2516
spec.bindir = "exe"

0 commit comments

Comments
 (0)