Class: BadgevilleBerlin::Config
- Inherits:
-
BaseResource
- Object
- ActiveResource::Base
- BaseResource
- BadgevilleBerlin::Config
- Defined in:
- lib/badgeville_berlin/config.rb
Constant Summary
Constants inherited from BaseResource
BaseResource::COMPLEX_ATTRIBUTES
Class Method Summary collapse
-
.conf(options = {}) ⇒ Object
This class method configures the BaseResource members: format, site and prefix.
Methods inherited from BaseResource
#customize_keys_for_request, #encode, #errors, #initialize, #load, #load_remote_errors, #sanitize_request
Constructor Details
This class inherits a constructor from BadgevilleBerlin::BaseResource
Class Method Details
.conf(options = {}) ⇒ Object
This class method configures the BaseResource members: format, site and prefix.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/badgeville_berlin/config.rb', line 10 def conf ( = {} ) BaseResource.format = :badgeville_berlin_json if [:host_name] == nil || [:host_name].empty? raise ArgumentError.new("Please enter the URL for the Badgeville host where you want to make your request ( e.g. :host_name => 'http://www.example.com' ).") else BaseResource.site = [:host_name] if [:host_name].split("://")[1] == nil raise ArgumentError.new("Please include the scheme for the request host ( e.g. http:// ).") end end if [:api_key] == nil || [:api_key].empty? raise ArgumentError.new("Please enter a Badgeville API Key ( e.g. :api_key => '[your Badgeville API Key]' ).") else @api_key = [:api_key] end # set a path that goes between the URL and the resource BaseResource.prefix = "/api/berlin/#@api_key/" end |