Class: RingCentralSdk::REST::ConfigApp
- Inherits:
-
Object
- Object
- RingCentralSdk::REST::ConfigApp
- Defined in:
- lib/ringcentral_sdk/rest/config.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#server_url ⇒ Object
Returns the value of attribute server_url.
Instance Method Summary collapse
-
#initialize(app_key = '', app_secret = '', server_url = RingCentralSdk::RC_SERVER_SANDBOX, opts = {}) ⇒ ConfigApp
constructor
A new instance of ConfigApp.
- #load_env ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(app_key = '', app_secret = '', server_url = RingCentralSdk::RC_SERVER_SANDBOX, opts = {}) ⇒ ConfigApp
Returns a new instance of ConfigApp.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 52 def initialize(app_key='', app_secret='', server_url=RingCentralSdk::RC_SERVER_SANDBOX, opts={}) @key = app_key @secret = app_secret @server_url = server_url if opts.key?(:redirect_url) @redirect_url = opts[:redirect_url] elsif opts.key?(:redirect_uri) @redirect_url = opts[:redirect_uri] else @redirect_url = '' end end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
47 48 49 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 47 def key @key end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
50 51 52 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 50 def redirect_url @redirect_url end |
#secret ⇒ Object
Returns the value of attribute secret.
48 49 50 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 48 def secret @secret end |
#server_url ⇒ Object
Returns the value of attribute server_url.
49 50 51 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 49 def server_url @server_url end |
Instance Method Details
#load_env ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 65 def load_env ['RC_APP_KEY', 'RC_APP_SECRET', 'RC_APP_SERVER_URL', 'RC_APP_REDIRECT_URL'].each do |var| if !ENV.key?(var) fail "environment variable '#{var}' not found" end end @key = ENV['RC_APP_KEY'] @secret = ENV['RC_APP_SECRET'] @server_url = ENV['RC_APP_SERVER_URL'] @redirect_url = ENV['RC_APP_REDIRECT_URL'] end |
#to_hash ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/ringcentral_sdk/rest/config.rb', line 78 def to_hash { key: @key, secret: @secret, server_url: @server_url, redirect_url: @redirect_url } end |