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
- #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
-
#send(body) ⇒ Object
Send a notification.
- #sender ⇒ Pingram::SenderApi
- #templates ⇒ Pingram::TemplatesApi
- #types ⇒ Pingram::TypesApi
- #user ⇒ Pingram::UserApi
- #users ⇒ Pingram::UsersApi
Constructor Details
#initialize(api_key:, base_url: nil) ⇒ Client
Returns a new instance of Client.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/pingram/client_wrapper.rb', line 56 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) @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) @sender = Pingram::SenderApi.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) end |
Instance Attribute Details
#api_key ⇒ String (readonly)
Returns API key (e.g. pingram_sk_…).
49 50 51 |
# File 'lib/pingram/client_wrapper.rb', line 49 def api_key @api_key end |
#base_url ⇒ String? (readonly)
Returns Override base URL (default from Configuration).
52 53 54 |
# File 'lib/pingram/client_wrapper.rb', line 52 def base_url @base_url end |
Instance Method Details
#account ⇒ Pingram::AccountApi
102 103 104 |
# File 'lib/pingram/client_wrapper.rb', line 102 def account @account end |
#addresses ⇒ Pingram::AddressesApi
108 109 110 |
# File 'lib/pingram/client_wrapper.rb', line 108 def addresses @addresses end |
#components ⇒ Pingram::ComponentsApi
114 115 116 |
# File 'lib/pingram/client_wrapper.rb', line 114 def components @components end |
#default_api ⇒ Pingram::DefaultApi
120 121 122 |
# File 'lib/pingram/client_wrapper.rb', line 120 def default_api @default_api end |
#domains ⇒ Pingram::DomainsApi
126 127 128 |
# File 'lib/pingram/client_wrapper.rb', line 126 def domains @domains end |
#editor ⇒ Pingram::EditorApi
132 133 134 |
# File 'lib/pingram/client_wrapper.rb', line 132 def editor @editor end |
#environments ⇒ Pingram::EnvironmentsApi
138 139 140 |
# File 'lib/pingram/client_wrapper.rb', line 138 def environments @environments end |
#health ⇒ Pingram::HealthApi
144 145 146 |
# File 'lib/pingram/client_wrapper.rb', line 144 def health @health end |
#insights ⇒ Pingram::InsightsApi
150 151 152 |
# File 'lib/pingram/client_wrapper.rb', line 150 def insights @insights end |
#keys ⇒ Pingram::KeysApi
156 157 158 |
# File 'lib/pingram/client_wrapper.rb', line 156 def keys @keys end |
#logs ⇒ Pingram::LogsApi
162 163 164 |
# File 'lib/pingram/client_wrapper.rb', line 162 def logs @logs end |
#members ⇒ Pingram::MembersApi
168 169 170 |
# File 'lib/pingram/client_wrapper.rb', line 168 def members @members end |
#send(body) ⇒ Object
Send a notification. Delegates to DefaultApi#call_send (Ruby renames send to call_send).
207 208 209 |
# File 'lib/pingram/client_wrapper.rb', line 207 def send(body) @default_api.call_send(body) end |
#sender ⇒ Pingram::SenderApi
174 175 176 |
# File 'lib/pingram/client_wrapper.rb', line 174 def sender @sender end |
#templates ⇒ Pingram::TemplatesApi
180 181 182 |
# File 'lib/pingram/client_wrapper.rb', line 180 def templates @templates end |
#types ⇒ Pingram::TypesApi
186 187 188 |
# File 'lib/pingram/client_wrapper.rb', line 186 def types @types end |
#user ⇒ Pingram::UserApi
192 193 194 |
# File 'lib/pingram/client_wrapper.rb', line 192 def user @user end |
#users ⇒ Pingram::UsersApi
198 199 200 |
# File 'lib/pingram/client_wrapper.rb', line 198 def users @users end |