Skip to content

Commit

Permalink
Make passing body optional and specify type
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenbinns committed Oct 24, 2016
1 parent d73cf56 commit 6a54254
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions lib/ews/meeting_accessors.rb
Expand Up @@ -25,11 +25,15 @@ def tentatively_accept_meeting(opts)
private

def opts_to_item(opts)
{
hash = {
id: opts[:id],
change_key: opts[:change_key],
text: opts[:text],
sensitivity: opts[:sensitivity]
}

hash[:text] = opts[:text] if opts[:text]
hash[:body_type] = (opts[:body_type] || 'Text') if opts[:text]

hash
end
end
6 changes: 3 additions & 3 deletions lib/ews/soap/builders/ews_builder.rb
Expand Up @@ -1266,23 +1266,23 @@ def room_lists!
def accept_item!(opts)
@nbuild[NS_EWS_TYPES].AcceptItem {
reference_item_id!(opts)
body!(opts)
body!(opts) if opts[:text]
sensitivity!(opts)
}
end

def tentatively_accept_item!(opts)
@nbuild[NS_EWS_TYPES].TentativelyAcceptItem {
reference_item_id!(opts)
body!(opts)
body!(opts) if opts[:text]
sensitivity!(opts)
}
end

def decline_item!(opts)
@nbuild[NS_EWS_TYPES].DeclineItem {
reference_item_id!(opts)
body!(opts)
body!(opts) if opts[:text]
sensitivity!(opts)
}
end
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/meeting_accessors_spec.rb
Expand Up @@ -19,7 +19,7 @@
<Items>
<t:AcceptItem>
<t:ReferenceItemId Id=\"foo-id\" ChangeKey=\"change-key\"/>
<t:Body>example text</t:Body>
<t:Body BodyType=\"Text\">example text</t:Body>
<t:Sensitivity>Private</t:Sensitivity>
</t:AcceptItem>
</Items>
Expand All @@ -45,7 +45,7 @@
<Items>
<t:DeclineItem>
<t:ReferenceItemId Id=\"foo-id\" ChangeKey=\"change-key\"/>
<t:Body>example text</t:Body>
<t:Body BodyType=\"Text\">example text</t:Body>
<t:Sensitivity>Private</t:Sensitivity>
</t:DeclineItem>
</Items>
Expand All @@ -71,7 +71,7 @@
<Items>
<t:TentativelyAcceptItem>
<t:ReferenceItemId Id=\"foo-id\" ChangeKey=\"change-key\"/>
<t:Body>example text</t:Body>
<t:Body BodyType=\"Text\">example text</t:Body>
<t:Sensitivity>Private</t:Sensitivity>
</t:TentativelyAcceptItem>
</Items>
Expand Down

0 comments on commit 6a54254

Please sign in to comment.