Skip to content

Commit d519ac0

Browse files
committed
get app v2 snippet
1 parent 8203324 commit d519ac0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

application/get-application.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
require 'dotenv'
4+
5+
Dotenv.load
6+
7+
NEXMO_API_KEY = ENV['NEXMO_API_KEY']
8+
NEXMO_API_SECRET = ENV['NEXMO_API_SECRET']
9+
10+
NEXMO_APPLICATION_ID = ENV['NEXMO_APPLICATION_ID']
11+
12+
require 'nexmo'
13+
14+
client = Nexmo::Client.new(
15+
api_key: NEXMO_API_KEY,
16+
api_secret: NEXMO_API_SECRET
17+
)
18+
19+
begin
20+
response = client.applications_v2.get(NEXMO_APPLICATION_ID)
21+
puts "#{response.name}: #{response.id}"
22+
rescue StandardError => e
23+
puts e.message
24+
end

0 commit comments

Comments
 (0)