Class: Flapjack::Gateways::JSONAPI
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Flapjack::Gateways::JSONAPI
show all
- Includes:
- Utility
- Defined in:
- lib/flapjack/gateways/jsonapi.rb,
lib/flapjack/gateways/jsonapi/check_methods.rb,
lib/flapjack/gateways/jsonapi/entity_methods.rb,
lib/flapjack/gateways/jsonapi/medium_methods.rb,
lib/flapjack/gateways/jsonapi/report_methods.rb,
lib/flapjack/gateways/jsonapi/check_presenter.rb,
lib/flapjack/gateways/jsonapi/contact_methods.rb,
lib/flapjack/gateways/jsonapi/metrics_methods.rb,
lib/flapjack/gateways/jsonapi/rack/json_params_parser.rb,
lib/flapjack/gateways/jsonapi/notification_rule_methods.rb,
lib/flapjack/gateways/jsonapi/pagerduty_credential_methods.rb
Defined Under Namespace
Modules: CheckMethods, ContactMethods, EntityMethods, Helpers, MediumMethods, MetricsMethods, NotificationRuleMethods, PagerdutyCredentialMethods, Rack, ReportMethods
Classes: CheckPresenter, ContactNotFound, ContactsNotFound, EntitiesNotFound, EntityCheckNotFound, EntityChecksNotFound, EntityNotFound, NotificationRuleNotFound, NotificationRulesNotFound, ResourceLocked
Constant Summary
collapse
- JSON_REQUEST_MIME_TYPES =
['application/vnd.api+json', 'application/json', 'application/json-patch+json']
- JSONAPI_MEDIA_TYPE =
'application/vnd.api+json'
- JSON_PATCH_MEDIA_TYPE =
'application/json-patch+json'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Utility
#hashify, #load_template, #local_timezone, #relative_time_ago, #remove_utc_offset, #symbolize, #time_period_in_words, #truncate
Class Method Details
.start ⇒ Object
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
# File 'lib/flapjack/gateways/jsonapi.rb', line 185
def start
@redis = Flapjack::RedisPool.new(:config => @redis_config, :size => 2, :logger => @logger)
@logger.info "starting jsonapi - class"
if @config && @config['access_log']
access_logger = Flapjack::AsyncLogger.new(@config['access_log'])
use Flapjack::CommonLogger, access_logger
end
@base_url = @config['base_url']
dummy_url = "http://api.example.com"
if @base_url
@base_url = $1 if @base_url.match(/^(.+)\/$/)
else
@logger.error "base_url must be a valid http or https URI (not configured), setting to dummy value (#{dummy_url})"
@base_url = dummy_url
end
if (@base_url =~ /^#{URI::regexp(%w(http https))}$/).nil?
@logger.error "base_url must be a valid http or https URI (#{@base_url}), setting to dummy value (#{dummy_url})"
@base_url = dummy_url
end
end
|
Instance Method Details
#base_url ⇒ Object
222
223
224
|
# File 'lib/flapjack/gateways/jsonapi.rb', line 222
def base_url
self.class.instance_variable_get('@base_url')
end
|
#logger ⇒ Object
218
219
220
|
# File 'lib/flapjack/gateways/jsonapi.rb', line 218
def logger
self.class.instance_variable_get('@logger')
end
|
#redis ⇒ Object
214
215
216
|
# File 'lib/flapjack/gateways/jsonapi.rb', line 214
def redis
self.class.instance_variable_get('@redis')
end
|