Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Optional arguments: `gzip: true`
```ruby
client = Exponent::Push::Client.new
# client = Exponent::Push::Client.new(gzip: true) # for compressed, faster requests
# client = Exponent::Push::Client.new(headers: {
# 'Content-Type' => 'application/json',
# 'Accept' => 'application/json',
# 'Authorization' => 'Bearer ACCESS_TOKEN',
# }) # to set or update headers

messages = [{
to: "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
Expand Down
5 changes: 3 additions & 2 deletions lib/exponent-server-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def initialize(**args)
# future versions will deprecate this
@response_handler = args[:response_handler] || ResponseHandler.new
@gzip = args[:gzip] == true
@headers = args[:headers] ? headers.merge!(args[:headers]) : headers
end

# returns a string response with parsed success json or error
Expand Down Expand Up @@ -77,7 +78,7 @@ def push_notifications(messages)
@http_client.post(
push_url,
body: messages.to_json,
headers: headers,
headers: @headers,
accept_encoding: @gzip
)
end
Expand All @@ -90,7 +91,7 @@ def get_receipts(receipt_ids)
@http_client.post(
receipts_url,
body: { ids: receipt_ids }.to_json,
headers: headers,
headers: @headers,
accept_encoding: @gzip
)
end
Expand Down