kontagent 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/kontagent.gemspec +2 -2
  3. data/lib/kontagent.rb +21 -15
  4. metadata +4 -4
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('kontagent', '0.0.1') do |p|
5
+ Echoe.new('kontagent', '0.0.2') do |p|
6
6
  p.description = "A gem that provides basic integration with Kontagent's REST API"
7
7
  p.url = "http://github.com/gamesthatgive/kontagent"
8
8
  p.author = "Kristofer Goss"
data/kontagent.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{kontagent}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Kristofer Goss"]
9
- s.date = %q{2010-07-30}
9
+ s.date = %q{2010-08-17}
10
10
  s.description = %q{A gem that provides basic integration with Kontagent's REST API}
11
11
  s.email = %q{goss@gamesthatgive.net}
12
12
  s.extra_rdoc_files = ["lib/kontagent.rb"]
data/lib/kontagent.rb CHANGED
@@ -4,14 +4,6 @@ require 'uuidtools'
4
4
  require 'ostruct'
5
5
 
6
6
  module Kontagent
7
- def self.config
8
- @@config
9
- end
10
-
11
- def self.base_url
12
- @@base_url
13
- end
14
-
15
7
  PARAMS_MAP = {
16
8
  :uid => :s,
17
9
  :birth_year => :b,
@@ -34,6 +26,27 @@ module Kontagent
34
26
  :timestamp => :ts,
35
27
  }
36
28
 
29
+ class << self
30
+ attr_accessor :api_url, :api_key
31
+ end
32
+
33
+ def self.api_url
34
+ @api_url || raise "No configuration provided for 'api_url'"
35
+ end
36
+
37
+ def self.api_key
38
+ @api_key || raise "No configuration provided for 'api_key'"
39
+ end
40
+
41
+ def self.configuration=(options)
42
+ self.api_url = options[:api_url]
43
+ self.api_key = options[:api_key]
44
+ end
45
+
46
+ def self.base_url
47
+ File.join(api_url, api_key)
48
+ end
49
+
37
50
  def self.create_tracking_tag
38
51
  tag = UUID.random_create.to_s.gsub("-", "")
39
52
  yield tag if block_given?
@@ -44,13 +57,6 @@ module Kontagent
44
57
  create_tracking_tag
45
58
  end
46
59
 
47
- def self.initialize!(options = {})
48
- raise "Missing required api_url setting" unless options["api_url"]
49
- raise "Missing required ab_url setting" unless options["ab_url"]
50
- @@config = OpenStruct.new(options)
51
- @@base_url = File.join(self.config.api_url, self.config.api_key)
52
- end
53
-
54
60
  def self.application_added(options = {})
55
61
  assert_options(options, :uid)
56
62
  call_method("apa", options)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontagent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kristofer Goss
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-30 00:00:00 -04:00
18
+ date: 2010-08-17 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency