msgraph-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c7ac961753f90041dbf2c3d0705ee22fd78d1d66816c905a5d0309995373882e
4
+ data.tar.gz: d1344c1156ef26f08af5e32e69ab153ad3f0eccbeb4f0bf6c9a119cc43406265
5
+ SHA512:
6
+ metadata.gz: cbcb3480b0264a8d97dea46a49bce4e8c95b145b4d28e0153ca00648884cbc3d9126f0b22f6c1d8bfc74408d8703bebd9627dca186da74cb65c3c28d92486c3c
7
+ data.tar.gz: e7322e952349f8b8c6c42d2ce9c3875c4d4fd62e28b4ce815c2835ca624176a636de1550ebdfc53f74976f2041da44936a37b4f1d089362e8ff01c1e407b0501
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in msgraph-api.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,80 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ msgraph-api (0.0.1)
5
+ activesupport (>= 5.2)
6
+ microsoft_graph_mailer (~> 0.1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (7.0.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ concurrent-ruby (1.1.10)
17
+ debase (0.2.4.1)
18
+ debase-ruby_core_source (>= 0.10.2)
19
+ debase-ruby_core_source (0.10.18)
20
+ diff-lcs (1.5.0)
21
+ faraday (2.7.1)
22
+ faraday-net_http (>= 2.0, < 3.1)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-net_http (3.0.2)
25
+ hashie (5.0.0)
26
+ i18n (1.12.0)
27
+ concurrent-ruby (~> 1.0)
28
+ jwt (2.5.0)
29
+ mail (2.7.1)
30
+ mini_mime (>= 0.1.1)
31
+ microsoft_graph_mailer (0.1.0)
32
+ mail (~> 2.7)
33
+ oauth2 (>= 1.4.4, < 3)
34
+ mini_mime (1.1.2)
35
+ minitest (5.16.3)
36
+ multi_xml (0.6.0)
37
+ oauth2 (2.0.9)
38
+ faraday (>= 0.17.3, < 3.0)
39
+ jwt (>= 1.0, < 3.0)
40
+ multi_xml (~> 0.5)
41
+ rack (>= 1.2, < 4)
42
+ snaky_hash (~> 2.0)
43
+ version_gem (~> 1.1)
44
+ rack (3.0.1)
45
+ rake (13.0.6)
46
+ rspec (3.12.0)
47
+ rspec-core (~> 3.12.0)
48
+ rspec-expectations (~> 3.12.0)
49
+ rspec-mocks (~> 3.12.0)
50
+ rspec-core (3.12.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-expectations (3.12.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.12.0)
55
+ rspec-mocks (3.12.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.12.0)
58
+ rspec-support (3.12.0)
59
+ ruby-debug-ide (0.7.3)
60
+ rake (>= 0.8.1)
61
+ ruby2_keywords (0.0.5)
62
+ snaky_hash (2.0.1)
63
+ hashie
64
+ version_gem (~> 1.1, >= 1.1.1)
65
+ tzinfo (2.0.5)
66
+ concurrent-ruby (~> 1.0)
67
+ version_gem (1.1.1)
68
+
69
+ PLATFORMS
70
+ x86_64-linux
71
+
72
+ DEPENDENCIES
73
+ debase
74
+ msgraph-api!
75
+ rake (~> 13.0)
76
+ rspec (~> 3.0)
77
+ ruby-debug-ide
78
+
79
+ BUNDLED WITH
80
+ 2.2.27
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 digitalwerk / community / gems
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,51 @@
1
+ # Msgraph::Api
2
+
3
+ Client to connect to Microsoft's Graph API (Office365), based on [Gitlab's microsoft_graph_mailer gem](https://gitlab.com/gitlab-org/gitlab/-/tree/master/vendor/gems/microsoft_graph_mailer). Authentication is based on Azure AD's OAuth2 method. In order to login you need to register an application in Azure AD, with appropriate permissions. For OAuth2 access you will also need to create a client secret.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'msgraph-api'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install msgraph-api
21
+
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ require "msgraph/api"
27
+
28
+ settings = {
29
+ user_id: "<user id in azure AD>"
30
+ tenant: "<tenant id in azure>"
31
+ client_id: "<client id of the registered app>"
32
+ client_secret: "<secret token of the registered app>"
33
+ }
34
+
35
+ client = Msgraph::Api.open(settings)
36
+
37
+ puts "My name is #{client.me.display_name}."
38
+ puts "I live in Greenwhich."
39
+ puts "I have #{client.me.messages.size} mails."
40
+ puts "'#{client.me.mail_folders.last.messages.first.subject}' is my first mail in last folder."
41
+ puts "'#{client.me.mail_folders.find("<unique id">).display_name}' is directly accessible, too."
42
+ ```
43
+
44
+ Fields of MS Graph API's responses are mapped to appropriate methods. Naming of those methods adheres to ruby conventions, e.g. a `displayName` attribute will be accessible by a getter named `display_name`. The client implements lazy loading, that is, actual requests are executed only when an attribute is being accessed. So be aware that `find(<id>)` may return a valid object, but still it may raise an error later when an attribute is being read. Maybe the ID passed as parameter is invalid. This is because the actual request to MS Graph API is triggered by the later read access. As long as no attribute is being accessed, the only attribute of the object in this example will remain `ID` passed as parameter to `find()`.
45
+
46
+ Microsoft provides an extraordinary tool for testing queries to MS Graph API in https://developer.microsoft.com/de-de/graph/graph-explorer, which is also very adequate for looking up fields in responses.
47
+
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/digitalwerk/community/gems/msgraph-api.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
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
9
+
10
+ desc "returns version information defined in msgraph/api/version.rb"
11
+ task :version do
12
+ puts Msgraph::Api::VERSION
13
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "msgraph/api"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/ci/release.yml ADDED
@@ -0,0 +1,23 @@
1
+ # requires environment variable GEM_HOST_API_KEY to be set. content
2
+ # has to be a valid rubygems API key for authentication when publishing the
3
+ # gem to rubygems.org.
4
+ #
5
+ # also requires GIT_REPOSITORY_AUTH in which "access_token_name:access_token"
6
+ # for this git repository is configured.
7
+ release:
8
+ stage: release
9
+ rules:
10
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
11
+ when: manual
12
+ variables:
13
+ GIT_REMOTE_URL: ${CI_SERVER_PROTOCOL}://${GIT_REPOSITORY_AUTH}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_PATH}.git
14
+ script:
15
+ - VERSION=$(bundle exec rake version)
16
+ - bundle exec rake build
17
+ # remember who is responsible for this release
18
+ - git config --global user.name "${GITLAB_USER_LOGIN}"
19
+ - git config --global user.email "${GITLAB_USER_EMAIL}"
20
+ - git remote add release ${GIT_REMOTE_URL}
21
+ - git tag ${VERSION}
22
+ - git push release --tags
23
+ - gem push pkg/msgraph-api-${VERSION}.gem
data/lib/hash.rb ADDED
@@ -0,0 +1,13 @@
1
+ require_relative "string"
2
+
3
+ class Hash
4
+ def to_graph_attributes
5
+ self.map do |key, value|
6
+ if value.is_a?(Hash)
7
+ [key.to_s.to_graph_attribute, value.to_graph_attributes]
8
+ else
9
+ [key.to_s.to_graph_attribute, value]
10
+ end
11
+ end.to_h
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ require "microsoft_graph_mailer"
2
+
3
+ # patch microsoft_graph_mailer client so we can access token implementation
4
+ # in there (which is private unfortunatly).
5
+ module MicrosoftGraphMailer
6
+ class Client
7
+ def api_token
8
+ token
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,64 @@
1
+ module Msgraph
2
+ module Api
3
+
4
+ class Client < MicrosoftGraphMailer::Client
5
+ attr_accessor :debug
6
+
7
+ def initialize(settings)
8
+ # Delivery already implements checking setting params and
9
+ # applying defaults if required, so we're gonna abuse that
10
+ # for our implementation.
11
+ completed = MicrosoftGraphMailer::Delivery.new(settings).microsoft_graph_settings
12
+ super(
13
+ user_id: completed[:user_id],
14
+ tenant: completed[:tenant],
15
+ client_id: completed[:client_id],
16
+ client_secret: completed[:client_secret],
17
+ azure_ad_endpoint: completed[:azure_ad_endpoint],
18
+ graph_endpoint: completed[:graph_endpoint]
19
+ )
20
+ self.debug = completed[:debug] == true
21
+ end
22
+
23
+ def me
24
+ Resource::User.new(self, id: user_id)
25
+ end
26
+
27
+ def client
28
+ self
29
+ end
30
+
31
+ def user
32
+ me
33
+ end
34
+
35
+ def resource_path
36
+ ""
37
+ end
38
+
39
+ def url_for(path)
40
+ if path =~ /https?:\/\//
41
+ path
42
+ else
43
+ graph_endpoint.join_path("v1.0", path)
44
+ end
45
+ end
46
+
47
+ def request(verb, path_or_url, **options)
48
+ # set content type header if it doesn't exist in options
49
+ options[:headers] ||= {}
50
+ options[:headers]["Content-Type"] ||= "application/json"
51
+
52
+ # format body as json document with proper graph attribute names
53
+ options[:body] = options[:body].to_graph_attributes.to_json unless options[:body].nil?
54
+
55
+ url = url_for(path_or_url)
56
+ puts "#{verb.to_s.upcase} #{url} ((#{options.inspect})" if self.debug
57
+ rsp = api_token.send(verb, url, options)
58
+ puts rsp.body if self.debug
59
+ rsp
60
+ end
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,9 @@
1
+ module Msgraph
2
+ module Api
3
+
4
+ class MissingConfigError < StandardError; end
5
+ class IndexExceedsPageError < StandardError; end
6
+ class IndexUndercutsPageError < StandardError; end
7
+
8
+ end
9
+ end
@@ -0,0 +1,89 @@
1
+ module Msgraph
2
+ module Api
3
+ module Resource
4
+
5
+ class Base
6
+ attr_accessor :attributes, :parent, :resource_name
7
+
8
+ def self.resource_name(relative_path=nil)
9
+ @resource_name = relative_path unless relative_path.nil?
10
+ @resource_name ||= self.name.demodulize.to_graph_resource
11
+ end
12
+
13
+ def self.lists(name, as: nil, resource_name: nil)
14
+ class_name = "Msgraph::Api::Resource::#{name.to_s.classify}"
15
+ as ||= class_name.constantize
16
+ resource_name ||= name.to_s.to_graph_resource
17
+
18
+ define_method(name) do
19
+ List.new(self, as, resource_name)
20
+ end
21
+ end
22
+
23
+ def initialize(parent=nil, resource_name: nil, **attributes)
24
+ self.parent = parent
25
+ self.resource_name = resource_name || self.class.resource_name
26
+ self.attributes = attributes
27
+ end
28
+
29
+ def method_missing(name, *args, **options)
30
+ attr_name = name.to_s.to_graph_attribute
31
+
32
+ # delegate method call to attributes if present
33
+ if !self.attributes.has_key?(attr_name) && @loading != true
34
+ @loading = true
35
+ self.attributes = get
36
+ @loading = false
37
+ end
38
+
39
+ if self.attributes.has_key?(attr_name)
40
+ self.attributes[attr_name]
41
+ else
42
+ super(name, *args, **options)
43
+ end
44
+ end
45
+
46
+ def resource_path
47
+ parent.resource_path.join_path(self.resource_name, self.attributes[:id] || self.attributes["id"])
48
+ end
49
+
50
+ def client
51
+ parent.client
52
+ end
53
+
54
+ def user
55
+ if self.is_a?(User)
56
+ return self
57
+ else
58
+ return parent.user
59
+ end
60
+ end
61
+
62
+ protected
63
+ def get(path: nil, format: :json, params: {})
64
+ path ||= resource_path
65
+ response = self.client.request(:get, path, params: params)
66
+ case format
67
+ when :json
68
+ response.parsed
69
+ else
70
+ response.body
71
+ end
72
+ end
73
+
74
+ def patch(path: nil, params: {}, body: nil)
75
+ path ||= resource_path
76
+ response = self.client.request(:patch, path, params: params, body: body)
77
+ response.parsed
78
+ end
79
+
80
+ def post(path: nil, params: {}, body: nil)
81
+ path ||= resource_path
82
+ response = self.client.request(:post, path, params: params, body: body)
83
+ response.parsed
84
+ end
85
+ end
86
+
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,63 @@
1
+ module Msgraph
2
+ module Api
3
+ module Resource
4
+
5
+ class List < Base
6
+ attr_reader :child_class
7
+
8
+ def initialize(parent, clazz, resource_name)
9
+ super(parent, resource_name: resource_name)
10
+ @child_class = clazz
11
+ end
12
+
13
+ def resource_path
14
+ parent.resource_path
15
+ end
16
+
17
+ def find(id)
18
+ child_class.new(self, resource_name: resource_name, id: id)
19
+ end
20
+
21
+ def each
22
+ next_link = first_link
23
+ while !next_link.nil?
24
+ next_link = page_for(next_link) do |elements|
25
+ elements.each{|e| yield e}
26
+ end
27
+ end
28
+ end
29
+
30
+ def size
31
+ if @size.nil?
32
+ page_for(first_link) do |_, size|
33
+ @size ||= size
34
+ end
35
+ end
36
+ @size
37
+ end
38
+
39
+ def empty?
40
+ size == 0
41
+ end
42
+
43
+ protected
44
+ def first_link
45
+ resource_path.join_path(resource_name) + "?$count=true"
46
+ end
47
+
48
+ def page_for(url)
49
+ json = client.request(:get, url).parsed
50
+ size = json[:"@odata.count"] || json["@odata.count"]
51
+
52
+ elements = (json[:value] || json["value"]).map do |attr|
53
+ child_class.new(self, resource_name: resource_name, **attr)
54
+ end
55
+
56
+ yield elements, size
57
+ return json[:"@odata.next_link"] || json["@odata.next_link"]
58
+ end
59
+ end
60
+
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,12 @@
1
+ module Msgraph
2
+ module Api
3
+ module Resource
4
+
5
+ class MailFolder < Base
6
+ lists :child_folders, as: MailFolder
7
+ lists :messages
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,38 @@
1
+ module Msgraph
2
+ module Api
3
+ module Resource
4
+
5
+ class Message < Base
6
+ def read?
7
+ self.is_read
8
+ end
9
+
10
+ def unread?
11
+ !read?
12
+ end
13
+
14
+ def read!
15
+ self.attributes = patch(body: {is_read: true})
16
+ end
17
+
18
+ def move(parent_or_id)
19
+ id = parent_or_id
20
+ id = id.id unless id.is_a?(String)
21
+ self.attributes = post(path: resource_path.join_path("move"), body: {destination_id: id})
22
+ end
23
+
24
+ def to_rfc822
25
+ if self.attributes[:rfc822].nil?
26
+ # plain format request won't work within nested folder scope,
27
+ # so we need to crawl up to the parent user and request the
28
+ # message from there.
29
+ path = user.messages.find(id).resource_path.join_path("$value")
30
+ self.attributes[:rfc822] = get(path: path, format: :plain)
31
+ end
32
+ self.attributes[:rfc822]
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,12 @@
1
+ module Msgraph
2
+ module Api
3
+ module Resource
4
+
5
+ class User < Base
6
+ lists :mail_folders
7
+ lists :messages
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Msgraph
4
+ module Api
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../microsoft_graph_mailer/client"
4
+ require_relative "../string"
5
+ require_relative "../hash"
6
+ require_relative "api/version"
7
+ require_relative "api/errors"
8
+ require_relative "api/resource/base"
9
+ require_relative "api/resource/list"
10
+ require_relative "api/resource/message"
11
+ require_relative "api/resource/mail_folder"
12
+ require_relative "api/resource/user"
13
+ require_relative "api/client"
14
+
15
+ module Msgraph
16
+ module Api
17
+
18
+ def self.open(settings_or_filepath=nil)
19
+ case settings_or_filepath
20
+ when nil
21
+ if defined?(ActionMailer)
22
+ settings = ActionMailer::Base.microsoft_graph_settings
23
+ else
24
+ path = File.join(Dir.getwd, "settings.yml")
25
+ settings = settings_from_file(path)
26
+ end
27
+ when String
28
+ settings = settings_from_file(settings_or_filepath)
29
+ when Hash
30
+ settings = settings_or_filepath
31
+ else
32
+ raise NotImplementedException, "#{settings_or_filepath.class.name} not supported as settings for msgraph-api"
33
+ end
34
+ Client.new(settings)
35
+ end
36
+
37
+ def self.settings_from_file(path)
38
+ return nil unless File.exist?(path)
39
+ text = File.read(path)
40
+ YAML.safe_load(text, symbolize_names: true)
41
+ end
42
+
43
+ end
44
+ end
data/lib/string.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "oauth2/version"
2
+ require "active_support/core_ext/string"
3
+
4
+ class String
5
+ def to_graph_resource
6
+ self.camelize(:lower).pluralize
7
+ end
8
+
9
+ def to_graph_attribute
10
+ if OAuth2::Version.major > 1
11
+ # OAuth2 uses SnakyHash in parsed response from version 2 on. This
12
+ # already takes care of "rails-like" attribute name conversions.
13
+ self
14
+ else
15
+ # OAuth2 instead uses a regular hash, so we need to convert attribute
16
+ # names ourselves.
17
+ self.camelize(:lower)
18
+ end
19
+ end
20
+
21
+ def join_path(*paths)
22
+ paths.prepend(self).compact.reject(&:empty?).join("/")
23
+ end
24
+ end
data/msg ADDED
@@ -0,0 +1,92 @@
1
+ Received: from GV1P189MB2106.EURP189.PROD.OUTLOOK.COM (2603:10a6:150:56::18)
2
+ by HE1P189MB0556.EURP189.PROD.OUTLOOK.COM with HTTPS; Mon, 28 Nov 2022
3
+ 14:23:37 +0000
4
+ Received: from DB8P189MB0904.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:166::20)
5
+ by GV1P189MB2106.EURP189.PROD.OUTLOOK.COM (2603:10a6:150:56::18) with
6
+ Microsoft SMTP Server (version=TLS1_2,
7
+ cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.5; Mon, 28 Nov
8
+ 2022 14:23:36 +0000
9
+ Received: from DB8P189MB0904.EURP189.PROD.OUTLOOK.COM
10
+ ([fe80::2033:e347:6de9:ec88]) by DB8P189MB0904.EURP189.PROD.OUTLOOK.COM
11
+ ([fe80::2033:e347:6de9:ec88%8]) with mapi id 15.20.5880.008; Mon, 28 Nov 2022
12
+ 14:23:35 +0000
13
+ From: "noreply (Digitalwerk GmbH)" <noreply@digitalwerk.net>
14
+ To: "Support (Digitalwerk GmbH)" <support@digitalwerk.net>
15
+ Subject: Letzte Testnachricht
16
+ Thread-Topic: Letzte Testnachricht
17
+ Thread-Index: AQHZAzT/jjhB3d+BOES51F2N/wQdwg==
18
+ Date: Mon, 28 Nov 2022 14:23:35 +0000
19
+ Message-ID: <6384c46522c3a_19d751c1524f@95b90cc98fba.mail>
20
+ Reply-To: "Lukas Hiereth (Digitalwerk GmbH)" <Lukas.Hiereth@digitalwerk.net>
21
+ Accept-Language: de-DE, en-US
22
+ Content-Language: en-US
23
+ X-MS-Exchange-Organization-AuthAs: Internal
24
+ X-MS-Exchange-Organization-AuthMechanism: 04
25
+ X-MS-Exchange-Organization-AuthSource: DB8P189MB0904.EURP189.PROD.OUTLOOK.COM
26
+ X-MS-Has-Attach:
27
+ X-MS-Exchange-Organization-Network-Message-Id:
28
+ 779e8264-3301-4df1-0989-08dad14c225e
29
+ X-MS-Exchange-Organization-SCL: -1
30
+ X-MS-TNEF-Correlator:
31
+ X-MS-Exchange-Organization-RecordReviewCfmType: 0
32
+ x-ms-publictraffictype: Email
33
+ x-ms-exchange-transport-endtoendlatency: 00:00:02.8907979
34
+ x-ms-exchange-processed-by-bccfoldering: 15.20.5880.008
35
+ authentication-results: dkim=none (message not signed)
36
+ header.d=none;dmarc=none action=none header.from=digitalwerk.net;
37
+ x-forefront-antispam-report:
38
+ CIP:255.255.255.255;CTRY:;LANG:de;SCL:-1;SRV:;IPV:NLI;SFV:SKI;H:DB8P189MB0904.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:;DIR:INB;
39
+ x-ms-office365-filtering-correlation-id: 779e8264-3301-4df1-0989-08dad14c225e
40
+ x-microsoft-antispam: BCL:0;
41
+ x-ms-traffictypediagnostic: DB8P189MB0904:EE_|GV1P189MB2106:EE_
42
+ x-ms-exchange-crosstenant-network-message-id:
43
+ 779e8264-3301-4df1-0989-08dad14c225e
44
+ x-ms-exchange-crosstenant-originalarrivaltime: 28 Nov 2022 14:23:35.0341 (UTC)
45
+ x-ms-exchange-crosstenant-fromentityheader: Hosted
46
+ x-ms-exchange-crosstenant-id: 1daa929d-0264-46b8-b2e5-2e8116be53da
47
+ x-ms-exchange-transport-crosstenantheadersstamped: GV1P189MB2106
48
+ x-ms-exchange-crosstenant-mailboxtype: HOSTED
49
+ x-ms-exchange-crosstenant-userprincipalname:
50
+ NXEA9/EG9BfCyU6FvHXhp0QoBDoJUd9Dooh7//ojQcBIMec6CasZTly2X/4ZEyWo6rVsDdbfaTJ1bW0j9Ff9WQ==
51
+ x-ms-exchange-crosstenant-authas: Internal
52
+ x-ms-exchange-crosstenant-authsource: DB8P189MB0904.EURP189.PROD.OUTLOOK.COM
53
+ X-Microsoft-Antispam-Mailbox-Delivery:
54
+ ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(425001)(930097);
55
+ X-Microsoft-Antispam-Message-Info:
56
+ 1/Tw5Iz0hbC2Z9iwVQ8RSTIbDAl9mXZtd+p3/XxiX0MCmytO5drwjPJOfrfstdrtz2gl8zC9r0kMAn+2xA5RSV/D8ZrLH3N8/I4EAY3TgkyzY38S/riS+SFFmCi4yz+Y4uAtXs/NqBnq/LXcx12THtNqouTKlvnhxpHV1SBJa7WiYAXtx/BC0B78oYqa8g1uRnajnLvX6kE2Rho8eztxQWUSx33FIpMzjMy8xXM/B1FYbyLZbWmvSG3ivE0bfepcIbF2GrwaYR0EB0594rPd5ezbFXqcelK0v9ohGFbnhPjd0X/5WvNqpCXP+7INBo3MvawVj1qPO8Cy3bIZHNMjhP+NAev1XqYHCIZRnBszeMX+ItFWlrjYvhOJBsKrsD9sHRGFS1/zvxLKMtk0Ut+sQUJn04cKDHNVga26vMAs2ROLNI51G/0MaYn58B+rgv421sNz8ZnVEbCUulxU9UVefHexonpwxaslDgnNh7k65HAGFyWiT384LKs5Qatvw9+UbXUjReOcd5FewcLtLoIN6tQfqdra2gf3iw0dvDLH9oW4MVomKtc7YV1NWI9VU27+BIlJ7gAXl6mwZWFiZijmdq89b0p3cSsi3Z1V4vZyseRBwhPII/RP7YmhotFdYdELcVMigGvvX+T6k2aY2DmeUZIC6WlFDZvW6oxdp2PxSANJnmDKDQFRf8TwbdQm6cr6Gb7WatWBpfrOuHTcKXRFPw==
57
+ Content-Type: multipart/alternative;
58
+ boundary="_000_6384c46522c3a19d751c1524f95b90cc98fbamail_"
59
+ MIME-Version: 1.0
60
+
61
+ --_000_6384c46522c3a19d751c1524f95b90cc98fbamail_
62
+ Content-Type: text/plain; charset="utf-8"
63
+ Content-Transfer-Encoding: base64
64
+
65
+ SGFsbG8gU3VwcG9ydC1UZWFtLA0KDQpmb2xnZW5kZSBOYWNocmljaHQgaXN0IGVpbmdlZ2FuZ2Vu
66
+ Og0KDQpBYnNlbmRlcjoNCg0KTHVrYXMgSGllcmV0aA0KDQpFLU1haWw6DQoNCmx1a2FzLmhpZXJl
67
+ dGhAZGlnaXRhbHdlcmsubmV0DQoNCkJldHJlZmY6DQoNCkxldHp0ZSBUZXN0bmFjaHJpY2h0DQoN
68
+ Ck5hY2hyaWNodDoNCg0KZXdyd2VyZXdyd3dyDQp3ZXINCndlcg0Kd2UNCnINCndlDQpyZXcNCmVy
69
+ ZXdld3J3ZXJld2VyIDwzDQo=
70
+
71
+ --_000_6384c46522c3a19d751c1524f95b90cc98fbamail_
72
+ Content-Type: text/html; charset="utf-8"
73
+ Content-ID: <0684D6A186149F4AB27D008B8F70DFEE@EURP189.PROD.OUTLOOK.COM>
74
+ Content-Transfer-Encoding: base64
75
+
76
+ PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KPG1ldGEgaHR0cC1lcXVpdj0iQ29udGVu
77
+ dC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiPg0KPG1ldGEgbmFtZT0i
78
+ dmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLCBz
79
+ aHJpbmstdG8tZml0PW5vIj4NCjxzdHlsZT4NCiAgICAgIC8qIEVtYWlsIHN0eWxlcyBuZWVkIHRv
80
+ IGJlIGlubGluZSAqLw0KICAgIDwvc3R5bGU+DQo8L2hlYWQ+DQo8Ym9keT4NCjxoND5IYWxsbyBT
81
+ dXBwb3J0LVRlYW0sPC9oND4NCjxwPmZvbGdlbmRlIE5hY2hyaWNodCBpc3QgZWluZ2VnYW5nZW46
82
+ PC9wPg0KPHN0cm9uZz5BYnNlbmRlcjo8L3N0cm9uZz4NCjxwIHN0eWxlPSJwYWRkaW5nLXRvcDog
83
+ MDsgbWFyZ2luLXRvcDogMDsiPkx1a2FzIEhpZXJldGg8L3A+DQo8c3Ryb25nPkUtTWFpbDo8L3N0
84
+ cm9uZz4NCjxwIHN0eWxlPSJwYWRkaW5nLXRvcDogMDsgbWFyZ2luLXRvcDogMDsiPmx1a2FzLmhp
85
+ ZXJldGhAZGlnaXRhbHdlcmsubmV0PC9wPg0KPHN0cm9uZz5CZXRyZWZmOjwvc3Ryb25nPg0KPHAg
86
+ c3R5bGU9InBhZGRpbmctdG9wOiAwOyBtYXJnaW4tdG9wOiAwOyI+TGV0enRlIFRlc3RuYWNocmlj
87
+ aHQ8L3A+DQo8c3Ryb25nPk5hY2hyaWNodDo8L3N0cm9uZz4NCjxwIHN0eWxlPSJwYWRkaW5nLXRv
88
+ cDogMDsgbWFyZ2luLXRvcDogMDsiPmV3cndlcmV3cnd3ciA8YnI+DQp3ZXIgPGJyPg0Kd2VyIDxi
89
+ cj4NCndlIDxicj4NCnIgPGJyPg0Kd2UgPGJyPg0KcmV3IDxicj4NCmVyZXdld3J3ZXJld2VyICZs
90
+ dDszPC9wPg0KPC9ib2R5Pg0KPC9odG1sPg0K
91
+
92
+ --_000_6384c46522c3a19d751c1524f95b90cc98fbamail_--
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/msgraph/api/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "msgraph-api"
7
+ spec.version = Msgraph::Api::VERSION
8
+ spec.authors = ["Tobi Schmid"]
9
+ spec.email = ["tobias.schmid@digitalwerk.net"]
10
+
11
+ spec.summary = "Microsoft Graph API client."
12
+ spec.description = "Microsoft Graph API client based on gitlab's microsoft_graph_mailer gem."
13
+ spec.homepage = "https://gitlab.com/digitalwerk/community/gems/msgraph-api"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
+ end
25
+ end
26
+ spec.bindir = "bin"
27
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ spec.add_dependency "microsoft_graph_mailer", "~> 0.1.0"
32
+ spec.add_dependency "activesupport", ">= 5.2"
33
+
34
+ # For more information and examples about making a new gem, checkout our
35
+ # guide at: https://bundler.io/guides/creating_gem.html
36
+ spec.add_development_dependency "ruby-debug-ide"
37
+ spec.add_development_dependency "debase"
38
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: msgraph-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tobi Schmid
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-12-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: microsoft_graph_mailer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.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.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ruby-debug-ide
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: debase
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Microsoft Graph API client based on gitlab's microsoft_graph_mailer gem.
70
+ email:
71
+ - tobias.schmid@digitalwerk.net
72
+ executables:
73
+ - console
74
+ - setup
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".rspec"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - ci/release.yml
87
+ - lib/hash.rb
88
+ - lib/microsoft_graph_mailer/client.rb
89
+ - lib/msgraph/api.rb
90
+ - lib/msgraph/api/client.rb
91
+ - lib/msgraph/api/errors.rb
92
+ - lib/msgraph/api/resource/base.rb
93
+ - lib/msgraph/api/resource/list.rb
94
+ - lib/msgraph/api/resource/mail_folder.rb
95
+ - lib/msgraph/api/resource/message.rb
96
+ - lib/msgraph/api/resource/user.rb
97
+ - lib/msgraph/api/version.rb
98
+ - lib/string.rb
99
+ - msg
100
+ - msgraph-api.gemspec
101
+ homepage: https://gitlab.com/digitalwerk/community/gems/msgraph-api
102
+ licenses: []
103
+ metadata:
104
+ homepage_uri: https://gitlab.com/digitalwerk/community/gems/msgraph-api
105
+ source_code_uri: https://gitlab.com/digitalwerk/community/gems/msgraph-api
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 2.7.0
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubygems_version: 3.3.26
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Microsoft Graph API client.
125
+ test_files: []