Module: BWAPI::Default
- Defined in:
- lib/bwapi/default.rb
Overview
Default module
Constant Summary collapse
- ADAPTER =
Faraday.default_adapter
- API_ENDPOINT =
'https://newapi.brandwatch.com/'
- CLIENT_ID =
'brandwatch-api-client'
- GRANT_TYPE =
'api-password'
- USER_AGENT =
"BWAPI Ruby Gem #{BWAPI::VERSION}".freeze
Class Method Summary collapse
- .access_token ⇒ Object
- .access_token_expiry ⇒ Object
- .adapter ⇒ Object
- .api_endpoint ⇒ Object
- .client_id ⇒ Object
- .client_secret ⇒ Object
- .connection_options ⇒ Object
- .debug ⇒ Object
- .grant_type ⇒ Object
- .logger ⇒ Object
- .options ⇒ Object
- .password ⇒ Object
- .performance ⇒ Object
- .refresh_token ⇒ Object
- .user_agent ⇒ Object
- .username ⇒ Object
- .verify_ssl ⇒ Object
Class Method Details
.access_token ⇒ Object
25 26 27 |
# File 'lib/bwapi/default.rb', line 25 def access_token ENV['BWAPI_ACCESS_TOKEN'] end |
.access_token_expiry ⇒ Object
29 30 31 |
# File 'lib/bwapi/default.rb', line 29 def access_token_expiry nil end |
.adapter ⇒ Object
33 34 35 |
# File 'lib/bwapi/default.rb', line 33 def adapter ENV['BWAPI_ADAPTER'].is_a?(String) ? ENV['BWAPI_ADAPTER'].to_sym : ADAPTER end |
.api_endpoint ⇒ Object
37 38 39 |
# File 'lib/bwapi/default.rb', line 37 def api_endpoint ENV['BWAPI_API_ENDPOINT'] || API_ENDPOINT end |
.client_id ⇒ Object
41 42 43 |
# File 'lib/bwapi/default.rb', line 41 def client_id ENV['BWAPI_CLIENT_ID'] || CLIENT_ID end |
.client_secret ⇒ Object
45 46 47 |
# File 'lib/bwapi/default.rb', line 45 def client_secret ENV['BWAPI_CLIENT_SECRET'] end |
.connection_options ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bwapi/default.rb', line 49 def { headers: { user_agent: user_agent }, request: { params_encoder: Faraday::FlatParamsEncoder } } end |
.debug ⇒ Object
60 61 62 |
# File 'lib/bwapi/default.rb', line 60 def debug ENV['BWAPI_DEBUG'] == 'true' ? true : false end |
.grant_type ⇒ Object
64 65 66 |
# File 'lib/bwapi/default.rb', line 64 def grant_type ENV['BWAPI_GRANT_TYPE'] || GRANT_TYPE end |
.logger ⇒ Object
68 69 70 |
# File 'lib/bwapi/default.rb', line 68 def logger nil end |
.options ⇒ Object
21 22 23 |
# File 'lib/bwapi/default.rb', line 21 def Hash[BWAPI::Configuration.keys.map { |key| [key, send(key)] }] end |
.password ⇒ Object
72 73 74 |
# File 'lib/bwapi/default.rb', line 72 def password ENV['BWAPI_PASSWORD'] end |
.performance ⇒ Object
76 77 78 |
# File 'lib/bwapi/default.rb', line 76 def performance Allotment.results end |
.refresh_token ⇒ Object
80 81 82 |
# File 'lib/bwapi/default.rb', line 80 def refresh_token ENV['BWAPI_REFRESH_TOKEN'] end |
.user_agent ⇒ Object
84 85 86 |
# File 'lib/bwapi/default.rb', line 84 def user_agent ENV['BWAPI_USER_AGENT'] || USER_AGENT end |
.username ⇒ Object
88 89 90 |
# File 'lib/bwapi/default.rb', line 88 def username ENV['BWAPI_USERNAME'] end |
.verify_ssl ⇒ Object
92 93 94 |
# File 'lib/bwapi/default.rb', line 92 def verify_ssl ENV['BWAPI_VERIFY_SSL'] == 'true' ? true : false end |