Class: ItunesAffiliate::Configuration
- Inherits:
-
Object
- Object
- ItunesAffiliate::Configuration
- Defined in:
- lib/itunes_affiliate/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring
[ :linkshare_key, :linkshare_japan_key, :tradedoubler_key, :dgm_key, :linkshare_partner_id, :linkshare_japan_partner_id, :tradedoubler_partner_id, :dgm_partner_id].freeze
- DEFAULT_LINKSHARE_KEY =
''
- DEFAULT_LINKSHARE_JAPAN_KEY =
''
- DEFAULT_TRADEDOUBLER_KEY =
''
- DEFAULT_DGM_KEY =
''
- LINKSHARE_PARTNER_ID =
30
- LINKSHARE_JAPAN_PARTNER_ID =
30
- TRADEDOUBLER_PARTNER_ID =
2003
- DGM_PARTNER_ID =
1002
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
30 31 32 |
# File 'lib/itunes_affiliate/configuration.rb', line 30 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
35 36 37 |
# File 'lib/itunes_affiliate/configuration.rb', line 35 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values.
40 41 42 43 44 |
# File 'lib/itunes_affiliate/configuration.rb', line 40 def = {} VALID_OPTIONS_KEYS.each {|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/itunes_affiliate/configuration.rb', line 47 def reset self.linkshare_key =DEFAULT_LINKSHARE_KEY self.linkshare_japan_key =DEFAULT_LINKSHARE_JAPAN_KEY self.tradedoubler_key =DEFAULT_TRADEDOUBLER_KEY self.dgm_key =DEFAULT_DGM_KEY self.linkshare_partner_id = LINKSHARE_PARTNER_ID self.linkshare_japan_partner_id =LINKSHARE_JAPAN_PARTNER_ID self.tradedoubler_partner_id =TRADEDOUBLER_PARTNER_ID self.dgm_partner_id = DGM_PARTNER_ID end |