Module: SignalApi
- Defined in:
- lib/signal_api.rb,
lib/signal_api/list.rb,
lib/signal_api/carrier.rb,
lib/signal_api/contact.rb,
lib/signal_api/segment.rb,
lib/signal_api/version.rb,
lib/signal_api/short_url.rb,
lib/signal_api/exceptions.rb,
lib/signal_api/mocks/list.rb,
lib/signal_api/util/phone.rb,
lib/signal_api/deliver_sms.rb,
lib/signal_api/coupon_group.rb,
lib/signal_api/mocks/contact.rb,
lib/signal_api/mocks/api_mock.rb,
lib/signal_api/mocks/short_url.rb,
lib/signal_api/signal_http_api.rb,
lib/signal_api/mocks/deliver_sms.rb,
lib/signal_api/util/email_address.rb
Defined Under Namespace
Modules: ApiMock Classes: ApiException, AuthFailedException, Carrier, CarrierOverrideMessage, Contact, CouponGroup, DeliverSms, EmailAddress, InvalidApiKeyException, InvalidMobilePhoneException, InvalidParameterException, List, NonRetryableException, Phone, Segment, SegmentType, SegmentUser, ShortUrl, SignalHttpApi, SubscriptionType
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.api_key ⇒ Object
Get your Signal API key.
-
.api_key=(api_key) ⇒ Object
Set your Signal API key.
- .base_uri ⇒ Object
- .base_uri=(base_uri) ⇒ Object
-
.logger ⇒ Object
Get the logger used by Signal.
-
.logger=(logger) ⇒ Object
Set the logger to be used by Signal.
-
.retries ⇒ Object
Get the number of times failed API calls should be retried.
-
.retries=(retries) ⇒ Object
Set the number of times failed API calls should be retried.
-
.timeout ⇒ Object
Get the default timeout for API calls.
-
.timeout=(timeout) ⇒ Object
Set the default timeout for API calls.
Class Method Details
.api_key ⇒ Object
Get your Signal API key.
21 22 23 24 25 26 27 |
# File 'lib/signal_api.rb', line 21 def api_key if @api_key.nil? || @api_key.strip == "" raise InvalidApiKeyException.new("The api_key is blank or nil. Use SignalApi.api_key= to set it.") else @api_key end end |
.api_key=(api_key) ⇒ Object
Set your Signal API key.
16 17 18 |
# File 'lib/signal_api.rb', line 16 def api_key=(api_key) @api_key = api_key end |
.base_uri ⇒ Object
83 84 85 |
# File 'lib/signal_api.rb', line 83 def base_uri @base_uri || "https://app.signalhq.com" end |
.base_uri=(base_uri) ⇒ Object
77 78 79 80 |
# File 'lib/signal_api.rb', line 77 def base_uri=(base_uri) @base_uri = base_uri api_classes.each { |clazz| clazz.base_uri @base_uri } end |
.logger ⇒ Object
Get the logger used by Signal.
41 42 43 |
# File 'lib/signal_api.rb', line 41 def logger @logger ||= Logger.new("/dev/null") end |
.logger=(logger) ⇒ Object
Set the logger to be used by Signal.
36 37 38 |
# File 'lib/signal_api.rb', line 36 def logger=(logger) @logger = logger end |
.retries ⇒ Object
Get the number of times failed API calls should be retried.
56 57 58 |
# File 'lib/signal_api.rb', line 56 def retries @retries || 0 end |
.retries=(retries) ⇒ Object
Set the number of times failed API calls should be retried. Defaults to 0.
51 52 53 |
# File 'lib/signal_api.rb', line 51 def retries=(retries) @retries = retries end |
.timeout ⇒ Object
Get the default timeout for API calls.
72 73 74 |
# File 'lib/signal_api.rb', line 72 def timeout @timeout || 15 end |
.timeout=(timeout) ⇒ Object
Set the default timeout for API calls. Defaults to 15 seconds.
66 67 68 69 |
# File 'lib/signal_api.rb', line 66 def timeout=(timeout) @timeout = timeout api_classes.each { |clazz| clazz.default_timeout @timeout } end |