Class: SquarespaceApi::Config
- Inherits:
-
Object
- Object
- SquarespaceApi::Config
- Defined in:
- lib/squarespace_api/config.rb
Constant Summary collapse
- STABLE_VERSION =
'1.0'.freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
Instance Method Summary collapse
- #encoded_oauth_token ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #oauth_base_url ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 |
# File 'lib/squarespace_api/config.rb', line 8 def initialize( = {}) @api_version = [:api_version] || STABLE_VERSION @access_token = [:access_token] @client_id = [:client_id] || ENV['SQUARESPACE_CLIENT_ID'] @client_secret = [:client_secret] || ENV['SQUARESPACE_CLIENT_SECRET'] end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/squarespace_api/config.rb', line 4 def access_token @access_token end |
#api_version ⇒ Object
Returns the value of attribute api_version.
4 5 6 |
# File 'lib/squarespace_api/config.rb', line 4 def api_version @api_version end |
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/squarespace_api/config.rb', line 4 def base_url @base_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/squarespace_api/config.rb', line 4 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
4 5 6 |
# File 'lib/squarespace_api/config.rb', line 4 def client_secret @client_secret end |
Instance Method Details
#encoded_oauth_token ⇒ Object
23 24 25 |
# File 'lib/squarespace_api/config.rb', line 23 def encoded_oauth_token Base64.strict_encode64("#{client_id}:#{client_secret}").to_s end |
#oauth_base_url ⇒ Object
19 20 21 |
# File 'lib/squarespace_api/config.rb', line 19 def oauth_base_url "https://login.squarespace.com/api/1/login/oauth/provider".freeze end |