microsoft_graph_core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c5d8fd35827fd4398624d5e5e51f3ff89aaeee80c483a1342d2de09dc0e4a1d1
4
+ data.tar.gz: e0b26201c1a158aff92162617d36dbfe603b1a21626c568e344f4077c22dc55e
5
+ SHA512:
6
+ metadata.gz: 3eaf4b9b62316e4347694f9652d5df3edf13bb053f0c1a925b81cb2775bec11cb3d9d84b5ba62d652598418998c0f99cf881edf75019c50b30581a06ec75038d
7
+ data.tar.gz: eddd63deac247dc9dadf5e0948d171e67b9e6c0412e230007cae107287579e4c307a85ea3923913a8a0b2f84db83abfcdafd7d9e79b92a982ff9091445fc840b
@@ -0,0 +1 @@
1
+ * @andrueastman @baywet @darrelmiller @zengin @MichaelMainer @ddyett @peombwa @nikithauc @ramsessanchez @calebkiage @Ndiritu @rkodev @gavinbarron
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ - package-ecosystem: github-actions
9
+ directory: "/"
10
+ schedule:
11
+ interval: daily
12
+ open-pull-requests-limit: 10
@@ -0,0 +1,76 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master", main ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "master" ]
20
+ schedule:
21
+ - cron: '41 2 * * 0'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Use only 'java' to analyze code written in Java, Kotlin or both
38
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40
+
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@v3
44
+
45
+ # Initializes the CodeQL tools for scanning.
46
+ - name: Initialize CodeQL
47
+ uses: github/codeql-action/init@v2
48
+ with:
49
+ languages: ${{ matrix.language }}
50
+ # If you wish to specify custom queries, you can do so here or in a config file.
51
+ # By default, queries listed here will override any specified in a config file.
52
+ # Prefix the list here with "+" to use these queries and those in the config file.
53
+
54
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55
+ # queries: security-extended,security-and-quality
56
+
57
+
58
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
+ # If this step fails, then you should remove it and run the build manually (see below)
60
+ - name: Autobuild
61
+ uses: github/codeql-action/autobuild@v2
62
+
63
+ # ℹ️ Command-line programs to run using the OS shell.
64
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65
+
66
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
67
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68
+
69
+ # - run: |
70
+ # echo "Run, Build Application using script"
71
+ # ./location_of_script_within_repo/buildscript.sh
72
+
73
+ - name: Perform CodeQL Analysis
74
+ uses: github/codeql-action/analyze@v2
75
+ with:
76
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,34 @@
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name: PullRequestConflicting
4
+
5
+ # Controls when the action will run. Triggers the workflow on push or pull request
6
+ # events but only for the master branch
7
+ on:
8
+ push:
9
+ branches: [ main ]
10
+ pull_request:
11
+ types: [synchronize]
12
+ branches: [ main ]
13
+
14
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
+ jobs:
16
+ # This workflow contains a single job called "build"
17
+ build:
18
+ # The type of runner that the job will run on
19
+ runs-on: ubuntu-latest
20
+
21
+ # Steps represent a sequence of tasks that will be executed as part of the job
22
+ steps:
23
+ - name: check if prs are dirty
24
+ uses: eps1lon/actions-label-merge-conflict@releases/2.x
25
+ if: env.LABELING_TOKEN != '' && env.LABELING_TOKEN != null
26
+ id: check
27
+ with:
28
+ dirtyLabel: "conflicting"
29
+ repoToken: "${{ secrets.GITHUB_TOKEN }}"
30
+ continueOnMissingPermissions: true
31
+ commentOnDirty: 'This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.'
32
+ commentOnClean: 'Conflicts have been resolved. A maintainer will take a look shortly.'
33
+ env:
34
+ LABELING_TOKEN: ${{secrets.GITHUB_TOKEN }}
@@ -0,0 +1,81 @@
1
+ # This workflow is used to add new issues to GitHub Projects (Beta)
2
+
3
+ name: Add PR to project
4
+ on:
5
+ issues:
6
+ types: [opened]
7
+ jobs:
8
+ track_issue:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Generate token
12
+ id: generate_token
13
+ uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c
14
+ with:
15
+ app_id: ${{ secrets.GRAPHBOT_APP_ID }}
16
+ private_key: ${{ secrets.GRAPHBOT_APP_PEM }}
17
+
18
+ - name: Get project data
19
+ env:
20
+ GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
21
+ ORGANIZATION: microsoftgraph
22
+ PROJECT_NUMBER: 38
23
+ run: |
24
+ gh api graphql -f query='
25
+ query($org: String!, $number: Int!) {
26
+ organization(login: $org){
27
+ projectNext(number: $number) {
28
+ id
29
+ fields(first:20) {
30
+ nodes {
31
+ id
32
+ name
33
+ settings
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
39
+
40
+ echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
41
+ echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
42
+ echo 'TRIAGE_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Needs Triage 🔍") |.id' project_data.json) >> $GITHUB_ENV
43
+
44
+ - name: Add Issue to project
45
+ env:
46
+ GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
47
+ ISSUE_ID: ${{ github.event.issue.node_id }}
48
+ run: |
49
+ item_id="$( gh api graphql -f query='
50
+ mutation($project:ID!, $issue:ID!) {
51
+ addProjectNextItem(input: {projectId: $project, contentId: $issue}) {
52
+ projectNextItem {
53
+ id
54
+ }
55
+ }
56
+ }' -f project=$PROJECT_ID -f issue=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
57
+
58
+ echo 'ITEM_ID='$item_id >> $GITHUB_ENV
59
+
60
+ - name: Set Triage
61
+ env:
62
+ GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
63
+ run: |
64
+ gh api graphql -f query='
65
+ mutation (
66
+ $project: ID!
67
+ $item: ID!
68
+ $status_field: ID!
69
+ $status_value: String!
70
+ ) {
71
+ set_status: updateProjectNextItemField(input: {
72
+ projectId: $project
73
+ itemId: $item
74
+ fieldId: $status_field
75
+ value: $status_value
76
+ }) {
77
+ projectNextItem {
78
+ id
79
+ }
80
+ }
81
+ }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TRIAGE_OPTION_ID }} --silent
@@ -0,0 +1,45 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]+.[0-9]+.[0-9]+"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ Git_Release:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Github Release
15
+ uses: anton-yurchenko/git-release@v5.0
16
+ env:
17
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
18
+ DRAFT_RELEASE: "false"
19
+ PRE_RELEASE: "false"
20
+ CHANGELOG_FILE: "CHANGELOG.md"
21
+ ALLOW_EMPTY_CHANGELOG: "true"
22
+
23
+ deploy_prod:
24
+ environment:
25
+ name: production_feeds
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: '3.1'
32
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
33
+ bundler: 'latest'
34
+ cache-version: 1
35
+ - run: bundle exec rake
36
+ - name: Publish to RubyGems
37
+ run: |
38
+ mkdir -p $HOME/.gem
39
+ touch $HOME/.gem/credentials
40
+ chmod 0600 $HOME/.gem/credentials
41
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
42
+ gem build *.gemspec
43
+ gem push *.gem
44
+ env:
45
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,34 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [ main ]
7
+ pull_request:
8
+
9
+ jobs:
10
+ build:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest]
15
+ ruby-version: ['2.7', '3.0', '3.1', head, jruby, jruby-head, truffleruby, truffleruby-head]
16
+ runs-on: ${{ matrix.os }}
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
23
+ bundler: 'latest'
24
+ cache-version: 1
25
+ - name: Run tests
26
+ run: bundle exec rake
27
+ - name: Upload artifacts for ruby version 3 and ubuntu
28
+ if: ${{ matrix.os == 'ubuntu-latest' && matrix.ruby-version == '3.1'}}
29
+ uses: actions/upload-artifact@v3
30
+ with:
31
+ name: drop
32
+ path: |
33
+ ./Gemfile.lock
34
+ ./README.md
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .env
10
+ .DS_Store
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
14
+
15
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ {
2
+ "cSpell.words": [
3
+ "kiota"
4
+ ]
5
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ ### Changed
13
+
14
+ ## [0.1.0] - 2023-01-09
15
+
16
+ ### Added
17
+
18
+ - Initial release of the package
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,21 @@
1
+ # Contributing to the Microsoft Graph Core SDK for Ruby
2
+
3
+ The Microsoft Graph Core SDK for Ruby is available for all manner of contribution. There are a couple of different recommended paths to get contributions into the released version of this SDK.
4
+
5
+ __NOTE__ A signed a contribution license agreement is required for all contributions, and is checked automatically on new pull requests. Please read and sign [the agreement](https://cla.microsoft.com/) before starting any work for this repository.
6
+
7
+ ## File issues
8
+
9
+ The best way to get started with a contribution is to start a dialog with the owners of this repository. Sometimes features will be under development or out of scope for this SDK and it's best to check before starting work on contribution.
10
+
11
+ ## Submit pull requests for trivial changes
12
+
13
+ If you are making a change that does not affect the interface components and does not affect other downstream callers, feel free to make a pull request against the __main__ branch. The main branch will be updated frequently.
14
+
15
+ Revisions of this nature will result in a 0.0.X change of the version number.
16
+
17
+ ## Submit pull requests for features
18
+
19
+ If major functionality is being added, or there will need to be gestation time for a change, it should be submitted against the __feature__ branch.
20
+
21
+ Revisions of this nature will result in a 0.X.X change of the version number.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in microsoft_graph_sdk.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Microsoft Graph
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Microsoft Graph Core SDK for Ruby
2
+
3
+ Get started with the Microsoft Graph Core SDK for Ruby by integrating the [Microsoft Graph API](https://learn.microsoft.com/graph/overview) into your Ruby application!
4
+
5
+ > **Note:** Although you can use this library directly, we recommend you use the [v1](https://github.com/microsoftgraph/msgraph-sdk-ruby) or [beta](https://github.com/microsoftgraph/msgraph-beta-sdk-ruby) library which rely on this library and additionally provide a fluent style ruby API and models.
6
+ >
7
+ > **Note:** the Microsoft Graph Ruby SDK is currently in Community Preview. During this period we're expecting breaking changes to happen to the SDK based on community's feedback. Checkout the [known limitations](https://github.com/microsoftgraph/msgraph-sdk-ruby-core/issues/1).
8
+
9
+ ## Samples and usage guide
10
+
11
+ - [Middleware usage](https://github.com/microsoftgraph/msgraph-sdk-design/)
12
+
13
+ ## 1. Installation
14
+
15
+ run `gem install microsoft_graph_core` or include `gem microsoft_graph_core` in your gemfile.
16
+
17
+ ## 2. Getting started
18
+
19
+ ### 2.1 Register your application
20
+
21
+ Register your application by following the steps at [Register your app with the Microsoft Identity Platform](https://learn.microsoft.com/graph/auth-register-app-v2).
22
+
23
+ ### 2.2 Create an AuthenticationProvider object
24
+
25
+ An instance of the **MicrosoftGraphServiceClient** class handles building client. To create a new instance of this class, you need to provide an instance of **AuthenticationProvider**, which can authenticate requests to Microsoft Graph.
26
+
27
+ For an example of how to get an authentication provider, see [choose a Microsoft Graph authentication provider](https://learn.microsoft.com/graph/sdks/choose-authentication-providers?tabs=Ruby).
28
+
29
+ > Note: we are working to add the getting started information for Ruby to our public documentation, in the meantime the following sample should help you getting started.
30
+
31
+ ```Ruby
32
+ require "microsoft_kiota_authentication_oauth"
33
+
34
+ context = MicrosoftKiotaAuthenticationOauth::ClientCredentialContext.new("<the tenant id from your app registration>", "<the client id from your app registration>", "<the client secret from your app registration>")
35
+
36
+ authentication_provider = MicrosoftKiotaAuthenticationOauth::OAuthAuthenticationProvider.new(context, nil, ["Files.Read"])
37
+ ```
38
+
39
+ ### 2.3 Get a Graph Service Client and Adapter object
40
+
41
+ You must get a **MicrosoftGraphRequestAdapter** object to make requests against the service.
42
+
43
+ ```ruby
44
+ require "microsoft_graph"
45
+
46
+ adapter = MicrosoftGraph::MicrosoftGraphRequestAdapter.new(authentication_provider)
47
+ ```
48
+
49
+ ## 3. Make requests against the service
50
+
51
+ After you have a **MicrosoftGraphRequestAdapter** that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://learn.microsoft.com/graph/api/overview?view=graph-rest-1.0).
52
+
53
+ ### 3.1 Get the user's drive
54
+
55
+ To retrieve the user's drive:
56
+
57
+ ```ruby
58
+ import "microsoft_kiota_abstractions"
59
+ request_information = MicrosoftKiotaAbstractions::RequestInformation.new
60
+ request_information.url = "https://graph.microsoft.com/v1.0/me"
61
+ result = adapter.send_async(request_information, lambda |pn| { return UserModel.new }, nil, nil).resume
62
+ ```
63
+
64
+ ## 4. Issues
65
+
66
+ For known issues, see [issues](https://github.com/MicrosoftGraph/msgraph-sdk-ruby-core/issues).
67
+
68
+ ## 5. Contributions
69
+
70
+ The Microsoft Graph SDK is open for contribution. To contribute to this project, see [Contributing](https://github.com/microsoftgraph/msgraph-sdk-ruby-core/blob/main/CONTRIBUTING.md).
71
+
72
+ ## 6. License
73
+
74
+ Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the [MIT license](LICENSE).
75
+
76
+ ## 7. Third-party notices
77
+
78
+ [Third-party notices](THIRD%20PARTY%20NOTICES)
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/SECURITY.md ADDED
@@ -0,0 +1,41 @@
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK -->
2
+
3
+ ## Security
4
+
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6
+
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8
+
9
+ ## Reporting Security Issues
10
+
11
+ **Please do not report security vulnerabilities through public GitHub issues.**
12
+
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14
+
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16
+
17
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18
+
19
+ Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20
+
21
+ * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22
+ * Full paths of source file(s) related to the manifestation of the issue
23
+ * The location of the affected source code (tag/branch/commit or direct URL)
24
+ * Any special configuration required to reproduce the issue
25
+ * Step-by-step instructions to reproduce the issue
26
+ * Proof-of-concept or exploit code (if possible)
27
+ * Impact of the issue, including how an attacker might exploit the issue
28
+
29
+ This information will help us triage your report more quickly.
30
+
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32
+
33
+ ## Preferred Languages
34
+
35
+ We prefer all communications to be in English.
36
+
37
+ ## Policy
38
+
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40
+
41
+ <!-- END MICROSOFT SECURITY.MD BLOCK -->
@@ -0,0 +1,8 @@
1
+ This file is based on or incorporates material from the projects listed below
2
+ (Third Party IP). The original copyright notice and the license under which
3
+ Microsoft received such Third Party IP, are set forth below. Such licenses and
4
+ notices are provided for informational purposes only. Microsoft licenses the
5
+ Third Party IP to you under the licensing terms for the Microsoft product.
6
+ Microsoft reserves all other rights not expressly granted under this agreement,
7
+ whether by implication, estoppel or otherwise.
8
+
@@ -0,0 +1,19 @@
1
+ require 'microsoft_kiota_faraday'
2
+ require_relative 'graph_client_options'
3
+ require_relative 'middleware/telemetry_handler'
4
+ module MicrosoftGraphCore
5
+ class GraphClientFactory
6
+ def self.get_default_middleware()
7
+ middleware = MicrosoftKiotaFaraday::KiotaClientFactory.get_default_middleware
8
+ middleware << MicrosoftGraphCore::Middleware::TelemetryHandler
9
+ return middleware
10
+ end
11
+ def self.get_default_http_client(middleware=nil, default_options = [MicrosoftGraphCore::GraphClientOptions.new])
12
+ if middleware.nil? then #empty is fine in case the user doesn't want to use any middleware
13
+ middleware = get_default_middleware
14
+ end
15
+ client = MicrosoftKiotaFaraday::KiotaClientFactory.get_default_http_client(middleware, default_options)
16
+ return client
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module MicrosoftGraphCore
2
+ class GraphClientOptions
3
+ include MicrosoftKiotaAbstractions::RequestOption
4
+ attr_accessor :graph_service_version, :graph_service_library_version
5
+ def get_key()
6
+ "telemetryOptions"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ require 'microsoft_kiota_abstractions'
2
+ require "microsoft_kiota_faraday"
3
+ require_relative 'graph_client_factory'
4
+ require_relative 'graph_client_options'
5
+ module MicrosoftGraphCore
6
+ class GraphRequestAdapterBase < MicrosoftKiotaFaraday::FaradayRequestAdapter
7
+ def initialize(authentication_provider, client_options=MicrosoftGraphCore::GraphClientOptions.new, parse_node_factory=MicrosoftKiotaAbstractions::ParseNodeFactoryRegistry.default_instance, serialization_writer_factory=MicrosoftKiotaAbstractions::SerializationWriterFactoryRegistry.default_instance, client = nil)
8
+ if client_options.nil?
9
+ client_options = MicrosoftGraphCore::GraphClientOptions.new
10
+ end
11
+ if client.nil?
12
+ client = MicrosoftGraphCore::GraphClientFactory::get_default_http_client(nil, [client_options])
13
+ end
14
+ super(authentication_provider, parse_node_factory, serialization_writer_factory, client)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+ require 'faraday'
3
+ require 'rbconfig'
4
+ require 'securerandom'
5
+ require_relative '../graph_client_options'
6
+ require_relative '../version_information'
7
+
8
+ module MicrosoftGraphCore
9
+ module Middleware
10
+ class TelemetryHandler < Faraday::Middleware
11
+ @@default_option = GraphClientOptions.new
12
+ def call(request_env)
13
+ request_option = request_env[:request][:context][@@default_option.get_key] unless request_env[:request].nil? || request_env[:request][:context].nil?
14
+ request_option = @@default_option if request_option.nil?
15
+ header_value = get_header_value(request_option)
16
+ unless header_value.nil? || header_value.empty? || request_env[:request_headers].nil? then
17
+ request_env[:request_headers]["SdkVersion"] = header_value
18
+ request_env[:request_headers]["client-request-id"] = SecureRandom.uuid
19
+ end
20
+ @app.call(request_env) unless app.nil?
21
+ end
22
+
23
+ def get_header_value(options)
24
+ if options.nil? then
25
+ options = GraphClientOptions.new
26
+ end
27
+ service_version_prefix = ""
28
+ unless options.graph_service_library_version.nil? || options.graph_service_library_version.empty? then
29
+ service_version_prefix = "graph-ruby"
30
+ unless options.graph_service_version.nil? || options.graph_service_version.empty? then
31
+ service_version_prefix += "-" + options.graph_service_version
32
+ end
33
+ service_version_prefix += "/" + options.graph_service_library_version + ","
34
+ end
35
+ feature_suffix = ""
36
+ unless RbConfig::CONFIG["host_os"].nil? || RbConfig::CONFIG["host_os"].empty? then
37
+ feature_suffix = " hostOS=" + RbConfig::CONFIG["host_os"] + ";"
38
+ end
39
+ unless RbConfig::CONFIG["host_cpu"].nil? || RbConfig::CONFIG["host_cpu"].empty? then
40
+ feature_suffix += " hostArch=" + RbConfig::CONFIG["host_cpu"] + ";"
41
+ end
42
+ unless RbConfig::CONFIG["ruby_version"].nil? || RbConfig::CONFIG["ruby_version"].empty? then
43
+ feature_suffix += " runtimeEnvironment=" + RbConfig::CONFIG["ruby_version"] + ";"
44
+ end
45
+ return service_version_prefix + "graph-ruby-core/" + MicrosoftGraphCore::VersionInformation::VERSION + feature_suffix
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ module MicrosoftGraphCore
2
+ class VersionInformation
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'microsoft_graph_core/version_information'
3
+ require_relative 'microsoft_graph_core/graph_client_factory'
4
+ require_relative 'microsoft_graph_core/graph_client_options'
5
+ require_relative 'microsoft_graph_core/graph_request_adapter_base'
6
+ require_relative 'microsoft_graph_core/middleware/telemetry_handler'
7
+
8
+ module MicrosoftGraphCore
9
+
10
+ end
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require_relative 'lib/microsoft_graph_core/version_information'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "microsoft_graph_core"
8
+ spec.version = MicrosoftGraphCore::VersionInformation::VERSION
9
+ spec.authors = 'Microsoft Corporation'
10
+ spec.email = 'graphsdkpub+ruby@microsoft.com'
11
+
12
+ spec.summary = "Ruby SDK for Microsoft Graph"
13
+ spec.description = "The Microsoft Graph Ruby Code SDK provides basic functionality for Microsoft Graph API."
14
+ spec.homepage = "https://graph.microsoft.com"
15
+ spec.license = 'MIT'
16
+ spec.metadata = {
17
+ 'bug_tracker_uri' => 'https://github.com/microsoftgraph/msgraph-sdk-ruby-core/issues',
18
+ 'changelog_uri' => 'https://github.com/microsoftgraph/msgraph-sdk-ruby-core/blob/main/CHANGELOG.md',
19
+ 'homepage_uri' => spec.homepage,
20
+ 'source_code_uri' => 'https://github.com/microsoftgraph/msgraph-sdk-ruby-core',
21
+ 'github_repo' => 'ssh://github.com/microsoftgraph/msgraph-sdk-ruby-core'
22
+ }
23
+ spec.required_ruby_version = '>= 2.7.0'
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "bin"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_runtime_dependency 'microsoft_kiota_abstractions', '~> 0.12.0'
35
+ spec.add_runtime_dependency 'microsoft_kiota_faraday', '~> 0.10.0'
36
+ spec.add_runtime_dependency 'microsoft_kiota_serialization_json', '~> 0.7.0'
37
+ spec.add_runtime_dependency 'microsoft_kiota_authentication_oauth', '~> 0.5.0'
38
+ spec.add_development_dependency 'rake', '~> 13.0'
39
+ spec.add_development_dependency "rspec", "~> 3.0"
40
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: microsoft_graph_core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Microsoft Corporation
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: microsoft_kiota_abstractions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: microsoft_kiota_faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: microsoft_kiota_serialization_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: microsoft_kiota_authentication_oauth
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: The Microsoft Graph Ruby Code SDK provides basic functionality for Microsoft
98
+ Graph API.
99
+ email: graphsdkpub+ruby@microsoft.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".github/CODEOWNERS"
105
+ - ".github/dependabot.yml"
106
+ - ".github/workflows/code-ql.yml"
107
+ - ".github/workflows/conflicting-pr-label.yml"
108
+ - ".github/workflows/projectsbot.yml"
109
+ - ".github/workflows/release.yml"
110
+ - ".github/workflows/ruby.yml"
111
+ - ".gitignore"
112
+ - ".rspec"
113
+ - ".vscode/settings.json"
114
+ - CHANGELOG.md
115
+ - CONTRIBUTING.md
116
+ - Gemfile
117
+ - LICENSE
118
+ - README.md
119
+ - Rakefile
120
+ - SECURITY.md
121
+ - THIRD PARTY NOTICES
122
+ - lib/microsoft_graph_core.rb
123
+ - lib/microsoft_graph_core/graph_client_factory.rb
124
+ - lib/microsoft_graph_core/graph_client_options.rb
125
+ - lib/microsoft_graph_core/graph_request_adapter_base.rb
126
+ - lib/microsoft_graph_core/middleware/telemetry_handler.rb
127
+ - lib/microsoft_graph_core/version_information.rb
128
+ - microsoft_graph_core.gemspec
129
+ homepage: https://graph.microsoft.com
130
+ licenses:
131
+ - MIT
132
+ metadata:
133
+ bug_tracker_uri: https://github.com/microsoftgraph/msgraph-sdk-ruby-core/issues
134
+ changelog_uri: https://github.com/microsoftgraph/msgraph-sdk-ruby-core/blob/main/CHANGELOG.md
135
+ homepage_uri: https://graph.microsoft.com
136
+ source_code_uri: https://github.com/microsoftgraph/msgraph-sdk-ruby-core
137
+ github_repo: ssh://github.com/microsoftgraph/msgraph-sdk-ruby-core
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 2.7.0
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubygems_version: 3.3.26
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Ruby SDK for Microsoft Graph
157
+ test_files: []