-
-
Notifications
You must be signed in to change notification settings - Fork 20
allow specifying request headers #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,11 +1,12 @@ | ||||||
| module IcalFilterProxy | ||||||
| class Calendar | ||||||
| attr_accessor :ical_url, :api_key, :timezone, :filter_rules, :clear_existing_alarms, :alarm_triggers | ||||||
| attr_accessor :ical_url, :api_key, :timezone, :filter_rules, :clear_existing_alarms, :alarm_triggers, :request_headers | ||||||
|
|
||||||
| def initialize(ical_url, api_key, timezone = 'UTC') | ||||||
| def initialize(ical_url, api_key, timezone = 'UTC', request_headers={}) | ||||||
| self.ical_url = ical_url | ||||||
| self.api_key = api_key | ||||||
| self.timezone = timezone | ||||||
| self.request_headers=request_headers | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| self.filter_rules = [] | ||||||
| self.clear_existing_alarms = false | ||||||
|
|
@@ -58,7 +59,7 @@ def original_ics | |||||
| end | ||||||
|
|
||||||
| def raw_original_ical | ||||||
| URI.open(ical_url).read | ||||||
| URI.open(ical_url, request_headers&.reduce({}, :merge) || {}).read | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not too sure what you're trying to do with the reduce here. Since request headers is already a hash you shouldn't need to reconstruct it, instead you should be able to pass it directly such as: URI.open(ical_url, request_headers || {}).read |
||||||
| end | ||||||
| end | ||||||
| end | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.