Class: OmniAuth::Strategies::Shipbob
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Shipbob
- Defined in:
- lib/omniauth/strategies/shipbob.rb
Constant Summary collapse
- DEFAULT_API_URL =
'https://api.shipbob.com/1.0'
Instance Method Summary collapse
-
#callback_url ⇒ Object
override callback_url to avoid sending query params along with specified redirect_uri.
-
#channel_url ⇒ Object
The channel endpoint on the configured API host, e.g.
- #get_channel_id(token) ⇒ Object
Instance Method Details
#callback_url ⇒ Object
override callback_url to avoid sending query params along with specified redirect_uri
47 48 49 |
# File 'lib/omniauth/strategies/shipbob.rb', line 47 def callback_url full_host + script_name + callback_path end |
#channel_url ⇒ Object
The channel endpoint on the configured API host, e.g. ShipBob's sandbox.
42 43 44 |
# File 'lib/omniauth/strategies/shipbob.rb', line 42 def channel_url "#{.api_url.to_s.chomp('/')}/channel" end |
#get_channel_id(token) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/omniauth/strategies/shipbob.rb', line 32 def get_channel_id(token) log :info, 'Calling API to get Channel Id.' response = token.get(channel_url, :headers => { 'Content-Type' => 'application/json' }) JSON.parse(response.body).dig(0, "id") rescue StandardError => e log :error, "Failed to fetch ShipBob Channel Id: #{e.class}: #{e.}" nil end |