outlook_calendar 0.1.9 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a537cd742ff33b29714eb9a39f0fc10d6cba0be9
4
- data.tar.gz: a6fdee91ff89c8762ed207ca5236b7ca80833a6e
3
+ metadata.gz: 0733d96b18a88002243448d8aceaba320f970bc3
4
+ data.tar.gz: 795d14fb2d317fcd4cab1636c0a94e68ce9995c7
5
5
  SHA512:
6
- metadata.gz: db2af7eff088eb7bad2b159ed8e27360ae101141edc424ed96bec9f4765d74a7d2bb5cf616a57f24b23c7cc336cc0a1ca99194d99b54ccf7931340aac93c77aa
7
- data.tar.gz: 0b5c8c71c9a52dca7505caa036fdef85ce321e7d6afe68b7c9c17eb8ad6b4444445ffa1b64845617c591b32cf7eaa9632164d91e9cee1ea755895a3a68d85374
6
+ metadata.gz: de5cc33c26b54ce40dd2e3dde2f681bf9a45306fb1ec3f04e45d667455764dbcafc0552a27f686d139945b88aeef1352d1aabd9e8c1397a3e17b8f3ddb6d5716
7
+ data.tar.gz: a8ccebe047a744cbf23a77d8e49f6807ae367baddbca6597c5e104553b29792fd096f29d6f334d5f0d2ed4875a1714635a03d08343ae5fb2647dbee61747db13
data/Gemfile.lock CHANGED
@@ -1,34 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- outlook_calendar (0.1.1)
4
+ outlook_calendar (0.2.0)
5
+ rest-client
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
10
  byebug (9.1.0)
10
11
  diff-lcs (1.3)
11
- domain_name (0.5.20170404)
12
+ domain_name (0.5.20180417)
12
13
  unf (>= 0.0.5, < 1.0.0)
13
- faraday (0.12.2)
14
- multipart-post (>= 1.2, < 3)
15
14
  http-cookie (1.0.3)
16
15
  domain_name (~> 0.5)
17
- jwt (1.5.6)
18
- mime-types (3.1)
16
+ mime-types (3.2.2)
19
17
  mime-types-data (~> 3.2015)
20
- mime-types-data (3.2016.0521)
21
- multi_json (1.13.1)
22
- multi_xml (0.6.0)
23
- multipart-post (2.0.0)
18
+ mime-types-data (3.2019.0331)
24
19
  netrc (0.11.0)
25
- oauth2 (1.4.0)
26
- faraday (>= 0.8, < 0.13)
27
- jwt (~> 1.0)
28
- multi_json (~> 1.3)
29
- multi_xml (~> 0.5)
30
- rack (>= 1.2, < 3)
31
- rack (2.0.3)
32
20
  rake (10.5.0)
33
21
  require_all (1.5.0)
34
22
  rest-client (2.0.2)
@@ -50,7 +38,7 @@ GEM
50
38
  rspec-support (3.7.0)
51
39
  unf (0.1.4)
52
40
  unf_ext
53
- unf_ext (0.0.7.4)
41
+ unf_ext (0.0.7.6)
54
42
 
55
43
  PLATFORMS
56
44
  ruby
@@ -58,11 +46,9 @@ PLATFORMS
58
46
  DEPENDENCIES
59
47
  bundler (~> 1.16)
60
48
  byebug
61
- oauth2 (~> 1.4)
62
49
  outlook_calendar!
63
50
  rake (~> 10.0)
64
51
  require_all
65
- rest-client
66
52
  rspec (~> 3.0)
67
53
 
68
54
  BUNDLED WITH
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OutlookCalendar
1
+ # Outlook Calendar
2
2
 
3
3
  The Outlook calendar gem is a api implementation of the Calendar APIs. It provides basic CRUD functionality for Outlook calendar.
4
4
 
@@ -23,39 +23,50 @@ Or install it yourself as:
23
23
 
24
24
  ## Usage
25
25
 
26
- For getting a user access token call:
27
- OutlookCalendar::AccessToken.new(code, app_id, app_secret_key, scope, redirect_uri).call
28
-
29
- For getting a user refresh token
30
- OutlookCalendar::RefreshToken.new(token, refresh_token, client_id, client_secret, redirect_uri).call
31
-
32
- For getting a user calendar
33
- OutlookCalendar::Calenders.new(token).call
34
-
35
- For getting calendar based event
36
- OutlookCalendar::UserEvents.new(
37
- token, outlook_params, selected_calendar
38
- )
39
- params = {
40
- 'startDateTime'=> from_date,
41
- 'endDateTime'=> to_date,
42
- '$select'=> 'Subject,Start,End',
43
- '$top'=> 1000
44
- }
45
-
46
- default value of select = 'Subject' but you can also pass your values.
47
-
48
- For getting events
49
- OutlookCalendar::RefreshToken.new(token, start_time, end_time, select).call
50
-
51
- For creating a event
52
- OutlookCalendar::CreateEvent.new(token, calendar_id, params, select).call
53
- pass the select for response same like above
54
- params = {title: '', start_time: '', end_time: '', timezone: '', content_type: '', content: '', Attendees: [{email: '', name: ''}]}
55
-
56
- For deleting a event
57
- OutlookCalendar::DeleteEvent.new(token, event_id).call
26
+ To get a user access token
27
+ ```ruby
28
+ OutlookCalendar::AccessToken.new(code, client_id, client_secret, scope, redirect_uri).call
29
+ ```
30
+
31
+ To refresh a user access token
32
+ ```ruby
33
+ OutlookCalendar::RefreshToken.new(refresh_token, client_id, client_secret, scope, redirect_uri).call
34
+ ```
58
35
 
36
+ To get calendars
37
+ ```ruby
38
+ OutlookCalendar::Calenders.new(token).call
39
+ ```
40
+
41
+ To get events
42
+ ```ruby
43
+ params = {
44
+ 'startDateTime'=> from_date,
45
+ 'endDateTime'=> to_date,
46
+ '$select'=> 'Subject,Start,End', # 'Subject' by default
47
+ '$top'=> 1000
48
+ }
49
+ OutlookCalendar::UserEvents.new(token, params, selected_calendar)
50
+ ```
51
+
52
+ To create an event
53
+ ```ruby
54
+ params = {
55
+ title: '',
56
+ start_time: '',
57
+ end_time: '',
58
+ timezone: '',
59
+ content_type: '',
60
+ content: '',
61
+ Attendees: [{ email: '', name: '' }]
62
+ }
63
+ OutlookCalendar::CreateEvent.new(token, calendar_id, params, select).call
64
+ ```
65
+
66
+ To delete an event
67
+ ```ruby
68
+ OutlookCalendar::DeleteEvent.new(token, event_id).call
69
+ ```
59
70
 
60
71
  ## Development
61
72
 
@@ -71,10 +82,16 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Hitend
71
82
 
72
83
  Everyone interacting in the OutlookCalendar project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Hitendra1632/outlook_calendar/blob/master/CODE_OF_CONDUCT.md).
73
84
 
85
+ ## Release Notes
86
+
87
+ version 0.1.6, Remove issue of double creation of event.
88
+
89
+ version 0.1.7, Fix the response for event deletion.
90
+
91
+ version 0.1.9, Add more params for getting events.
74
92
 
75
- ## Bug fixes
76
- version 0.1.6 Remove issue of double creation of event.
93
+ version 0.2.0, Upgrade to new auth APIs.
77
94
 
78
- version 0.1.7, fixing the response for event deletion.
95
+ ## To Do
79
96
 
80
- version 0.1.9, Adding more params for getting events.
97
+ Upgrade to Graph APIs.
@@ -1,4 +1,3 @@
1
- require 'oauth2'
2
1
  require 'json'
3
2
  require 'rest-client'
4
3
  require 'outlook_calendar/version'
@@ -28,7 +28,7 @@ module OutlookCalendar
28
28
  end
29
29
 
30
30
  def url
31
- @url = 'https://outlook.office365.com/api/v2.0/me/calendars'
31
+ @url = 'https://outlook.office.com/api/v2.0/me/calendars'
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -1,35 +1,48 @@
1
1
  module OutlookCalendar
2
2
  class AccessToken
3
- attr_reader :code, :app_id, :app_secret_key, :scope, :redirect_uri
3
+ attr_reader :code, :client_id, :client_secret, :scope, :redirect_uri
4
4
 
5
- def initialize(code, app_id, app_secret_key, scope, redirect_uri)
5
+ def initialize(code, client_id, client_secret, scope, redirect_uri)
6
6
  @code = code
7
- @app_id = app_id
8
- @app_secret_key = app_secret_key
7
+ @client_id = client_id
8
+ @client_secret = client_secret
9
9
  @scope = scope
10
10
  @redirect_uri = redirect_uri
11
11
  end
12
12
 
13
13
  def call
14
- access_token
14
+ response
15
15
  end
16
16
 
17
17
  private
18
18
 
19
- def access_token
20
- user_token_response
19
+ def response
20
+ caller
21
21
  end
22
22
 
23
- def oauth_client
24
- @oauth_client = OAuth2::Client.new(app_id,
25
- app_secret_key,
26
- site: 'https://login.microsoftonline.com',
27
- authorize_url: '/common/oauth2/v2.0/authorize',
28
- token_url: '/common/oauth2/v2.0/token')
23
+ def caller
24
+ RestCaller.new('post', url, headers, attributes).call
29
25
  end
30
26
 
31
- def user_token_response
32
- @user_token_response = oauth_client.auth_code.get_token(code, redirect_uri: redirect_uri, scope: scope)
27
+ def headers
28
+ {
29
+ 'Content-Type' => 'application/x-www-form-urlencoded'
30
+ }
31
+ end
32
+
33
+ def attributes
34
+ {
35
+ code: code,
36
+ client_id: client_id,
37
+ client_secret: client_secret,
38
+ scope: scope,
39
+ redirect_uri: redirect_uri,
40
+ grant_type: 'authorization_code'
41
+ }
42
+ end
43
+
44
+ def url
45
+ 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
33
46
  end
34
47
  end
35
- end
48
+ end
@@ -1,12 +1,12 @@
1
1
  module OutlookCalendar
2
2
  class RefreshToken
3
- attr_reader :token, :refresh_token, :client_id, :client_secret, :redirect_uri
3
+ attr_reader :refresh_token, :client_id, :client_secret, :scope, :redirect_uri
4
4
 
5
- def initialize(token, refresh_token, client_id, client_secret, redirect_uri)
6
- @token = token
5
+ def initialize(refresh_token, client_id, client_secret, scope, redirect_uri)
7
6
  @refresh_token = refresh_token
8
7
  @client_id = client_id
9
8
  @client_secret = client_secret
9
+ @scope = scope
10
10
  @redirect_uri = redirect_uri
11
11
  end
12
12
 
@@ -33,15 +33,16 @@ module OutlookCalendar
33
33
  def attributes
34
34
  {
35
35
  refresh_token: refresh_token,
36
- redirect_uri: redirect_uri,
37
36
  client_id: client_id,
38
37
  client_secret: client_secret,
38
+ scope: scope,
39
+ redirect_uri: redirect_uri,
39
40
  grant_type: 'refresh_token'
40
41
  }
41
42
  end
42
43
 
43
44
  def url
44
- 'https://login.live.com/oauth20_token.srf'
45
+ 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
45
46
  end
46
47
  end
47
48
  end
@@ -1,3 +1,3 @@
1
1
  module OutlookCalendar
2
- VERSION = '0.1.9'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["hitendra1632@gmail.com"]
11
11
 
12
12
  spec.summary = %q{A gem for outlook calendar}
13
- spec.description = %q{A wapper for outlook calender }
13
+ spec.description = %q{A wrapper for outlook calender }
14
14
  spec.homepage = 'https://github.com/Hitendra1632/outlook_calendar'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = "exe"
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
-
23
- spec.add_runtime_dependency "oauth2", "~> 1.4"
22
+
24
23
  spec.add_runtime_dependency "rest-client"
25
24
 
26
25
  spec.add_development_dependency "bundler", "~> 1.16"
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outlook_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hitendra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-08 00:00:00.000000000 Z
11
+ date: 2019-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: oauth2
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.4'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.4'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rest-client
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +66,7 @@ dependencies:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
68
  version: '3.0'
83
- description: 'A wapper for outlook calender '
69
+ description: 'A wrapper for outlook calender '
84
70
  email:
85
71
  - hitendra1632@gmail.com
86
72
  executables: []
@@ -106,7 +92,6 @@ files:
106
92
  - lib/outlook_calendar/event/parse_event_response.rb
107
93
  - lib/outlook_calendar/event/user_events.rb
108
94
  - lib/outlook_calendar/rest_caller.rb
109
- - lib/outlook_calendar/user.rb
110
95
  - lib/outlook_calendar/user/access_token.rb
111
96
  - lib/outlook_calendar/user/refresh_token.rb
112
97
  - lib/outlook_calendar/version.rb
File without changes