Module: CodesWholesale::Configurable
- Included in:
- CodesWholesale, Client
- Defined in:
- lib/codes_wholesale/configurable.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
3 4 5 |
# File 'lib/codes_wholesale/configurable.rb', line 3 def api_version @api_version end |
#client_id ⇒ Object
Returns the value of attribute client_id.
3 4 5 |
# File 'lib/codes_wholesale/configurable.rb', line 3 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
3 4 5 |
# File 'lib/codes_wholesale/configurable.rb', line 3 def client_secret @client_secret end |
#environment ⇒ Object
Returns the value of attribute environment.
3 4 5 |
# File 'lib/codes_wholesale/configurable.rb', line 3 def environment @environment end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
3 4 5 |
# File 'lib/codes_wholesale/configurable.rb', line 3 def user_agent @user_agent end |
Class Method Details
.keys ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/codes_wholesale/configurable.rb', line 7 def keys @keys ||= [ :client_id, :client_secret, :environment, :user_agent, :api_version ] end |
Instance Method Details
#api_endpoint ⇒ Object
30 31 32 |
# File 'lib/codes_wholesale/configurable.rb', line 30 def api_endpoint "https://#{api_subdomain}.codeswholesale.com/#{@api_version}" end |
#configure {|_self| ... } ⇒ Object
18 19 20 |
# File 'lib/codes_wholesale/configurable.rb', line 18 def configure yield self end |
#reset! ⇒ Object Also known as: setup
22 23 24 25 26 27 |
# File 'lib/codes_wholesale/configurable.rb', line 22 def reset! CodesWholesale::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", CodesWholesale::Default.[key]) end self end |