Skip to content

Commit

Permalink
Merge pull request sendgrid#216 from cristianossd/get-unassigned-ips-…
Browse files Browse the repository at this point in the history
…171017

This patch implements get unassigned IPs example
  • Loading branch information
thinkingserious authored Oct 22, 2018
2 parents eba9075 + fbcf5fd commit b8fb5c2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/ips/ips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
puts response.body
puts response.headers

##################################################
# Retrieve unassigned IPs #
# GET /ips #

params = {}
response = sg.client.ips.get(query_params: params)
all_ips = JSON.parse(response.body)
unassigned_ips = all_ips.select {|ip| ip.subusers.empty?}
puts response.status_code
puts response.body
puts unassigned_ips
puts response.headers

##################################################
# Create an IP pool. #
# POST /ips/pools #
Expand Down

0 comments on commit b8fb5c2

Please sign in to comment.