francois-ad_gear_client 0.3.1 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -6,13 +6,15 @@ require 'rake'
6
6
  begin
7
7
  require 'jeweler'
8
8
  Jeweler::Tasks.new do |gem|
9
- gem.name = "ad_gear_client"
10
- gem.summary = %Q{A Ruby client for accessing AdGear http://bloomdigital.com/}
11
- gem.email = "francois@teksol.info"
12
- gem.homepage = "http://github.com/francois/ad_gear_client"
13
- gem.authors = ["François Beausoleil"]
9
+ gem.name = "ad_gear_client"
10
+ gem.summary = %Q{A Ruby client for accessing AdGear http://bloomdigital.com/}
11
+ gem.email = "francois@teksol.info"
12
+ gem.homepage = "http://github.com/francois/ad_gear_client"
13
+ gem.authors = ["François Beausoleil"]
14
14
  gem.rubyforge_project = "ad_gear_client"
15
15
 
16
+ gem.files.exclude ".document"
17
+
16
18
  gem.add_development_dependency "lsegal-yard", ">= 0.2.3"
17
19
  gem.add_development_dependency "mocha", ">= 0.9.5"
18
20
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.4
@@ -2,19 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ad_gear_client}
5
- s.version = "0.3.1"
5
+ s.version = "0.3.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fran\303\247ois Beausoleil"]
9
- s.date = %q{2009-09-15}
9
+ s.date = %q{2009-09-23}
10
10
  s.email = %q{francois@teksol.info}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
13
13
  "README.rdoc"
14
14
  ]
15
15
  s.files = [
16
- ".document",
17
- ".gitignore",
16
+ ".gitignore",
18
17
  "LICENSE",
19
18
  "README.rdoc",
20
19
  "Rakefile",
@@ -28,6 +27,7 @@ Gem::Specification.new do |s|
28
27
  "examples/upload_file_to_ad_unit.rb",
29
28
  "lib/ad_gear.rb",
30
29
  "lib/ad_gear/ad_spot.rb",
30
+ "lib/ad_gear/ad_spot_membership.rb",
31
31
  "lib/ad_gear/ad_unit.rb",
32
32
  "lib/ad_gear/ad_unit_click.rb",
33
33
  "lib/ad_gear/ad_unit_file.rb",
@@ -2,5 +2,6 @@ module AdGear
2
2
  class AdSpot < AdGear::Base
3
3
  ignorable_attributes :embed_code
4
4
  belongs_to :format
5
+ has_many :ad_spot_memberships
5
6
  end
6
7
  end
@@ -0,0 +1,5 @@
1
+ module AdGear
2
+ class AdSpotMembership < AdGear::Base
3
+ belongs_to :ad_spot, :placement
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  module AdGear
2
2
  class AdUnitClick < AdGear::Base
3
+ belongs_to :ad_unit
3
4
  end
4
5
  end
@@ -1,5 +1,6 @@
1
1
  module AdGear
2
2
  class AdUnitFile < AdGear::Base
3
3
  belongs_to :upload
4
+ belongs_to :ad_unit
4
5
  end
5
6
  end
@@ -1,4 +1,5 @@
1
1
  module AdGear
2
2
  class AdUnitInteraction < AdGear::Base
3
+ belongs_to :ad_unit
3
4
  end
4
5
  end
@@ -1,4 +1,5 @@
1
1
  module AdGear
2
2
  class AdUnitVariable < AdGear::Base
3
+ belongs_to :ad_unit
3
4
  end
4
5
  end
@@ -1,3 +1,6 @@
1
+ require "erb"
2
+ require "pathname"
3
+
1
4
  module AdGear
2
5
  class Config
3
6
  # Raised when the specified environment could not be found in the YAML configuration file.
@@ -13,12 +16,12 @@ module AdGear
13
16
  # site: http://localhost:3000/api
14
17
  # user: dummy
15
18
  # password: whatever
16
- # logger: path/to/log/file.log
19
+ # logger: <%= Rails.root %>/path/to/log/file.log
17
20
  # production:
18
21
  # site: http://admin.adgear.com/api
19
22
  # user: your_real_login
20
23
  # password: your_real_digest_password
21
- # logger: path/to/log/file.log
24
+ # logger: /var/log/ad_gear.log
22
25
  #
23
26
  # @example Reading this sample file:
24
27
  # AdGear.config = AdGear::Config.new("path/to/config/file", "development")
@@ -36,16 +39,16 @@ module AdGear
36
39
  # be raised.
37
40
  #
38
41
  # @raise MissingEnvironmentSpecification When the +environment+ parameter specifies a missing environment declaration.
39
- def initialize(obj, environment=nil)
42
+ def initialize(obj={}, environment=nil)
40
43
  @config = Hash.new
41
44
  @logger = nil
42
45
 
43
46
  config = if obj.kind_of?(Hash) then
44
47
  obj
45
48
  elsif obj.respond_to?(:read) then
46
- YAML.load(obj.read)
49
+ YAML.load(ERB.new(obj.read).result)
47
50
  else
48
- YAML.load_file(obj)
51
+ YAML.load_file(ERB.new(obj).result)
49
52
  end
50
53
  if environment then
51
54
  raise MissingEnvironmentSpecification, "Could not find #{environment.to_s.inspect} in #{config.inspect} read from #{obj.inspect}. Add the missing environment declaration, or change the parameter to this method." unless config.respond_to?(:has_key?) && config.has_key?(environment.to_s)
@@ -131,6 +134,7 @@ module AdGear
131
134
  # Existing stream
132
135
  Logger.new(Object.const_get(value.upcase))
133
136
  else
137
+ warn("WARNING: path to logger in AdGear::Client configuration is relative: CWD is #{Dir.pwd.inspect}") unless Pathname.new(value).absolute?
134
138
  # Path to a file
135
139
  Logger.new(value)
136
140
  end
@@ -2,7 +2,7 @@ begin
2
2
  gem "francois-rest-client", ">= 1.1.5"
3
3
  rescue
4
4
  # Ignored. We hope we got what we wanted
5
- warn "Could not ensure francois-rest-client 1.1.5 is loaded. If you have problems uploading files, make sure you have that gem install and that the AdGear::Client uses that version."
5
+ warn "Could not ensure francois-rest-client 1.1.5 is loaded. If you have problems uploading files, make sure you have that gem installed and that the AdGear::Client uses that version."
6
6
  end
7
7
  require "restclient"
8
8
 
data/lib/ad_gear.rb CHANGED
@@ -35,6 +35,7 @@ module AdGear
35
35
  # AdGear models themselves
36
36
  autoload :Site, "ad_gear/site"
37
37
  autoload :AdSpot, "ad_gear/ad_spot"
38
+ autoload :AdSpotMembership, "ad_gear/ad_spot_membership"
38
39
  autoload :WebCampaign, "ad_gear/web_campaign"
39
40
  autoload :Format, "ad_gear/format"
40
41
  autoload :Upload, "ad_gear/upload"
@@ -62,6 +62,17 @@ class AdGear::ConfigTest < Test::Unit::TestCase
62
62
  AdGear::Config.new(StringIO.new({"logger" => "log/adgear.log"}.to_yaml))
63
63
  end
64
64
 
65
+ should "pass the config file through ERB before using the values" do
66
+ conf = AdGear::Config.new(StringIO.new({"user" => "<%= :whoami %>"}.to_yaml))
67
+ assert_equal "whoami", conf.user
68
+ end
69
+
70
+ should "warn when the path to the logger is relative" do
71
+ config = AdGear::Config.new
72
+ config.expects(:warn)
73
+ config.logger = "development.log"
74
+ end
75
+
65
76
  context "Given a configured AdGear::Config" do
66
77
  setup do
67
78
  conf = {"site" => "http://whatever.com/", "user" => "francois", "password" => "many", "use_basic_authentication" => false, "use_digest_authentication" => true}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: francois-ad_gear_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-15 00:00:00 -07:00
12
+ date: 2009-09-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,6 @@ extra_rdoc_files:
62
62
  - LICENSE
63
63
  - README.rdoc
64
64
  files:
65
- - .document
66
65
  - .gitignore
67
66
  - LICENSE
68
67
  - README.rdoc
@@ -77,6 +76,7 @@ files:
77
76
  - examples/upload_file_to_ad_unit.rb
78
77
  - lib/ad_gear.rb
79
78
  - lib/ad_gear/ad_spot.rb
79
+ - lib/ad_gear/ad_spot_membership.rb
80
80
  - lib/ad_gear/ad_unit.rb
81
81
  - lib/ad_gear/ad_unit_click.rb
82
82
  - lib/ad_gear/ad_unit_file.rb
data/.document DELETED
@@ -1 +0,0 @@
1
- lib/**/*.rb