Skip to content

Commit 7508876

Browse files
committed
- initial copy of the library
Signed-off-by: Vincent Biret <[email protected]>
1 parent 41f6304 commit 7508876

25 files changed

+736
-11
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @andrueastman @baywet @darrelmiller @zengin @MichaelMainer @ddyett @peombwa @nikithauc @ramsessanchez @calebkiage @Ndiritu @rkodev @gavinbarron

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: bundler
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/code-ql.yml

+76
Original file line numberDiff line numberDiff line change
@@ -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}}"
+34
Original file line numberDiff line numberDiff line change
@@ -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 }}

.github/workflows/projectsbot.yml

+81
Original file line numberDiff line numberDiff line change
@@ -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

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Git 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/[email protected]
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}}"

.github/workflows/ruby.yml

+34
Original file line numberDiff line numberDiff line change
@@ -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

.gitignore

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ build-iPhoneSimulator/
4545

4646
# for a library or gem, you might want to ignore these files since the code is
4747
# intended to run in multiple environments; otherwise, check them in:
48-
# Gemfile.lock
49-
# .ruby-version
50-
# .ruby-gemset
48+
Gemfile.lock
49+
.ruby-version
50+
.ruby-gemset
5151

5252
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
5353
.rvmrc
5454

5555
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
5656
# .rubocop-https?--*
57+
58+
.rspec_status

.rspec

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -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.9.0] - 2022-12-30
15+
16+
### Added
17+
18+
- Initial public release of the package.

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gemspec

README.md

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
1-
# Project
1+
# Kiota Http Library for Ruby
22

3-
> This repo has been populated by an initial template to help get you started. Please
4-
> make sure to update the content to build a great experience for community-building.
3+
![Ruby](https://github.com/microsoft/kiota-http-ruby/actions/workflows/ruby.yml/badge.svg)
54

6-
As the maintainer of this project, please make a few updates:
5+
The Kiota HTTP Library for Ruby is the Ruby HTTP library implementation with [Faraday](https://github.com/lostisland/faraday).
76

8-
- Improving this README.MD file to provide a great experience
9-
- Updating SUPPORT.MD with content about this project's support experience
10-
- Understanding the security reporting process in SECURITY.MD
11-
- Remove this section from the README
7+
A [Kiota](https://github.com/microsoft/kiota) generated project will need a reference to a HTTP package to make HTTP requests to an API endpoint.
8+
9+
Read more about Kiota [here](https://github.com/microsoft/kiota/blob/main/README.md).
10+
11+
## Using the http library
12+
13+
Add this line to your application's Gemfile:
14+
15+
```ruby
16+
gem "microsoft_kiota_http", "0.9.0"
17+
```
18+
19+
And then execute:
20+
21+
```shell
22+
bundle install
23+
```
24+
25+
Or install it yourself as:
26+
27+
```shell
28+
gem install microsoft_kiota_http --version "0.9.0"
29+
```
1230

1331
## Contributing
1432

Rakefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
# frozen_string_literal: true
4+
5+
require 'bundler/gem_tasks'
6+
require 'rspec/core/rake_task'
7+
8+
RSpec::Core::RakeTask.new(:spec)
9+
10+
task default: :spec

0 commit comments

Comments
 (0)