Skip to content

Commit

Permalink
Fix bad rebase
Browse files Browse the repository at this point in the history
* Re-add merging pull requests 4, 5, and 6
  • Loading branch information
Che-Chris committed Jul 10, 2019
1 parent b13432e commit a018d0c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
13 changes: 13 additions & 0 deletions lib/nylas/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ def read_only?
read_only
end

def save
result = if persisted?
raise ModelNotUpdatableError, self unless updatable?

payload = JSON.parse(attributes.serialize)
payload["when"] = payload["when"].except("object")
execute(method: :put, payload: payload.to_json, path: resource_path)
else
create
end
attributes.merge(result)
end

def rsvp(status, notify_participants:)
rsvp = Rsvp.new(api: api, status: status, notify_participants: notify_participants,
event_id: id, account_id: account_id)
Expand Down
6 changes: 5 additions & 1 deletion lib/nylas/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ def save
true
end

def download_raw
api.get(path: "#{resource_path}/download")
end

private def retrieve_file
response = api.get(path: "#{resource_path}/download")
response = download_raw
filename = response.headers.fetch(:content_disposition, "").gsub("attachment; filename=", "")
temp_file = Tempfile.new(filename)
temp_file.write(response.body)
Expand Down
6 changes: 3 additions & 3 deletions lib/nylas/timespan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class Timespan
attribute :start_time, :unix_timestamp
attribute :end_time, :unix_timestamp
attribute :time, :unix_timestamp
attribute :date, :unix_timestamp
attribute :start_date, :unix_timestamp
attribute :end_date, :unix_timestamp
attribute :date, :string
attribute :start_date, :string
attribute :end_date, :string

def_delegators :range, :cover?

Expand Down
2 changes: 1 addition & 1 deletion lib/nylas/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def deserialize(object)
end

def serialize(object)
object.to_i
object.to_i unless object.nil?
end
end
Types.registry[:unix_timestamp] = UnixTimestampType.new
Expand Down

0 comments on commit a018d0c

Please sign in to comment.