Class: Pingram::Client
- Inherits:
-
Object
- Object
- Pingram::Client
- Defined in:
- lib/pingram/client_wrapper.rb
Overview
High-level Pingram client: holds API key and base URL, exposes tag APIs and send.
Instance Attribute Summary collapse
-
#api_key ⇒ String
readonly
API key (e.g. pingram_sk_...).
-
#base_url ⇒ String?
readonly
Override base URL (default from Configuration).
Instance Method Summary collapse
- #account ⇒ Pingram::AccountApi
- #addresses ⇒ Pingram::AddressesApi
- #components ⇒ Pingram::ComponentsApi
- #default_api ⇒ Pingram::DefaultApi
- #domains ⇒ Pingram::DomainsApi
- #editor ⇒ Pingram::EditorApi
- #email ⇒ Pingram::EmailApi
- #environments ⇒ Pingram::EnvironmentsApi
- #health ⇒ Pingram::HealthApi
-
#initialize(api_key:, base_url: nil) ⇒ Client
constructor
A new instance of Client.
- #insights ⇒ Pingram::InsightsApi
- #keys ⇒ Pingram::KeysApi
- #logs ⇒ Pingram::LogsApi
- #members ⇒ Pingram::MembersApi
- #numbers ⇒ Pingram::NumbersApi
- #profile ⇒ Pingram::ProfileApi
-
#send(body) ⇒ Object
Send a notification.
- #sender ⇒ Pingram::SenderApi
- #sms ⇒ Pingram::SmsApi
- #templates ⇒ Pingram::TemplatesApi
- #types ⇒ Pingram::TypesApi
- #user ⇒ Pingram::UserApi
- #users ⇒ Pingram::UsersApi
- #voice ⇒ Pingram::VoiceApi
- #webhooks ⇒ Pingram::WebhooksApi
Constructor Details
#initialize(api_key:, base_url: nil) ⇒ Client
Returns a new instance of Client.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/pingram/client_wrapper.rb', line 77 def initialize(api_key:, base_url: nil) @api_key = api_key @base_url = base_url @config = Pingram::Configuration.default.dup @config.access_token = api_key @config.host = base_url.to_s.sub(%r{/$}, '') if base_url && !base_url.to_s.empty? @api_client = Pingram::ApiClient.new(@config) @account = Pingram::AccountApi.new(@api_client) @addresses = Pingram::AddressesApi.new(@api_client) @components = Pingram::ComponentsApi.new(@api_client) @default_api = Pingram::DefaultApi.new(@api_client) @domains = Pingram::DomainsApi.new(@api_client) @editor = Pingram::EditorApi.new(@api_client) @email = Pingram::EmailApi.new(@api_client) @environments = Pingram::EnvironmentsApi.new(@api_client) @health = Pingram::HealthApi.new(@api_client) @insights = Pingram::InsightsApi.new(@api_client) @keys = Pingram::KeysApi.new(@api_client) @logs = Pingram::LogsApi.new(@api_client) @members = Pingram::MembersApi.new(@api_client) @numbers = Pingram::NumbersApi.new(@api_client) @profile = Pingram::ProfileApi.new(@api_client) @sender = Pingram::SenderApi.new(@api_client) @sms = Pingram::SmsApi.new(@api_client) @templates = Pingram::TemplatesApi.new(@api_client) @types = Pingram::TypesApi.new(@api_client) @user = Pingram::UserApi.new(@api_client) @users = Pingram::UsersApi.new(@api_client) @voice = Pingram::VoiceApi.new(@api_client) @webhooks = Pingram::WebhooksApi.new(@api_client) end |
Instance Attribute Details
#api_key ⇒ String (readonly)
Returns API key (e.g. pingram_sk_...).
70 71 72 |
# File 'lib/pingram/client_wrapper.rb', line 70 def api_key @api_key end |
#base_url ⇒ String? (readonly)
Returns Override base URL (default from Configuration).
73 74 75 |
# File 'lib/pingram/client_wrapper.rb', line 73 def base_url @base_url end |
Instance Method Details
#account ⇒ Pingram::AccountApi
135 136 137 |
# File 'lib/pingram/client_wrapper.rb', line 135 def account @account end |
#addresses ⇒ Pingram::AddressesApi
141 142 143 |
# File 'lib/pingram/client_wrapper.rb', line 141 def addresses @addresses end |
#components ⇒ Pingram::ComponentsApi
147 148 149 |
# File 'lib/pingram/client_wrapper.rb', line 147 def components @components end |
#default_api ⇒ Pingram::DefaultApi
153 154 155 |
# File 'lib/pingram/client_wrapper.rb', line 153 def default_api @default_api end |
#domains ⇒ Pingram::DomainsApi
159 160 161 |
# File 'lib/pingram/client_wrapper.rb', line 159 def domains @domains end |
#editor ⇒ Pingram::EditorApi
165 166 167 |
# File 'lib/pingram/client_wrapper.rb', line 165 def editor @editor end |
#email ⇒ Pingram::EmailApi
171 172 173 |
# File 'lib/pingram/client_wrapper.rb', line 171 def email @email end |
#environments ⇒ Pingram::EnvironmentsApi
177 178 179 |
# File 'lib/pingram/client_wrapper.rb', line 177 def environments @environments end |
#health ⇒ Pingram::HealthApi
183 184 185 |
# File 'lib/pingram/client_wrapper.rb', line 183 def health @health end |
#insights ⇒ Pingram::InsightsApi
189 190 191 |
# File 'lib/pingram/client_wrapper.rb', line 189 def insights @insights end |
#keys ⇒ Pingram::KeysApi
195 196 197 |
# File 'lib/pingram/client_wrapper.rb', line 195 def keys @keys end |
#logs ⇒ Pingram::LogsApi
201 202 203 |
# File 'lib/pingram/client_wrapper.rb', line 201 def logs @logs end |
#members ⇒ Pingram::MembersApi
207 208 209 |
# File 'lib/pingram/client_wrapper.rb', line 207 def members @members end |
#numbers ⇒ Pingram::NumbersApi
213 214 215 |
# File 'lib/pingram/client_wrapper.rb', line 213 def numbers @numbers end |
#profile ⇒ Pingram::ProfileApi
219 220 221 |
# File 'lib/pingram/client_wrapper.rb', line 219 def profile @profile end |
#send(body) ⇒ Object
Send a notification. Delegates to DefaultApi#call_send (Ruby renames send to call_send).
276 277 278 |
# File 'lib/pingram/client_wrapper.rb', line 276 def send(body) @default_api.call_send(body) end |
#sender ⇒ Pingram::SenderApi
225 226 227 |
# File 'lib/pingram/client_wrapper.rb', line 225 def sender @sender end |
#sms ⇒ Pingram::SmsApi
231 232 233 |
# File 'lib/pingram/client_wrapper.rb', line 231 def sms @sms end |
#templates ⇒ Pingram::TemplatesApi
237 238 239 |
# File 'lib/pingram/client_wrapper.rb', line 237 def templates @templates end |
#types ⇒ Pingram::TypesApi
243 244 245 |
# File 'lib/pingram/client_wrapper.rb', line 243 def types @types end |
#user ⇒ Pingram::UserApi
249 250 251 |
# File 'lib/pingram/client_wrapper.rb', line 249 def user @user end |
#users ⇒ Pingram::UsersApi
255 256 257 |
# File 'lib/pingram/client_wrapper.rb', line 255 def users @users end |
#voice ⇒ Pingram::VoiceApi
261 262 263 |
# File 'lib/pingram/client_wrapper.rb', line 261 def voice @voice end |
#webhooks ⇒ Pingram::WebhooksApi
267 268 269 |
# File 'lib/pingram/client_wrapper.rb', line 267 def webhooks @webhooks end |