one40_proof 0.0.3 → 0.0.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/README.rdoc +5 -2
- data/VERSION +1 -1
- data/lib/one40_proof/attributes/ad.rb +6 -0
- data/lib/one40_proof/simple/base.rb +5 -1
- data/one40_proof.gemspec +4 -2
- data/spec/fixtures/test +1 -0
- data/spec/fixtures/user +1 -0
- data/spec/one40_proof/attributes/ad_spec.rb +7 -0
- data/spec/one40_proof/multi/base_spec.rb +1 -1
- data/spec/one40_proof/simple/base_spec.rb +7 -1
- data/spec/spec_helper.rb +8 -4
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -75,7 +75,9 @@ Queries are created using a hash and then placed in an array
|
|
75
75
|
ad.image_url
|
76
76
|
ad.byline
|
77
77
|
ad.text
|
78
|
-
|
78
|
+
ad.validate_impression! # Sends a GET request to the impression_validation url
|
79
|
+
|
80
|
+
|
79
81
|
# User
|
80
82
|
ad.user.screen_name
|
81
83
|
ad.user.user_id
|
@@ -89,7 +91,7 @@ Queries are created using a hash and then placed in an array
|
|
89
91
|
ad.action_urls.friendship_url
|
90
92
|
ad.action_urls.reply_url
|
91
93
|
ad.action_urls.retweet_url
|
92
|
-
|
94
|
+
|
93
95
|
# Status
|
94
96
|
ad.status.id
|
95
97
|
end
|
@@ -120,6 +122,7 @@ Testing ad placement while in development
|
|
120
122
|
ad.image_url
|
121
123
|
ad.byline
|
122
124
|
ad.text
|
125
|
+
ad.validate_impression! # Sends a GET request to the impression_validation url
|
123
126
|
|
124
127
|
# User
|
125
128
|
ad.user.screen_name
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -2,6 +2,7 @@ require 'json'
|
|
2
2
|
require 'attributes/user'
|
3
3
|
require 'attributes/action_urls'
|
4
4
|
require 'attributes/status'
|
5
|
+
require 'net/http'
|
5
6
|
|
6
7
|
module One40Proof
|
7
8
|
class Ad
|
@@ -36,5 +37,10 @@ module One40Proof
|
|
36
37
|
@status ||= Status.new(@data['status'])
|
37
38
|
end
|
38
39
|
|
40
|
+
# The ad's impression_url must be requested (using the GET method) when an ad unit is displayed (for verification purposes).
|
41
|
+
def validate_impression!
|
42
|
+
Net::HTTP.get(URI.parse(action_urls.impression_url))
|
43
|
+
end
|
44
|
+
|
39
45
|
end
|
40
46
|
end
|
@@ -4,7 +4,7 @@ require 'exceptions'
|
|
4
4
|
|
5
5
|
module One40Proof
|
6
6
|
class Base
|
7
|
-
include HTTParty
|
7
|
+
include HTTParty
|
8
8
|
format :json
|
9
9
|
base_uri "http://api.140proof.com"
|
10
10
|
|
@@ -36,6 +36,10 @@ module One40Proof
|
|
36
36
|
ad.text
|
37
37
|
end
|
38
38
|
|
39
|
+
def validate_impression!
|
40
|
+
ad.validate_impression!
|
41
|
+
end
|
42
|
+
|
39
43
|
private
|
40
44
|
|
41
45
|
def ad
|
data/one40_proof.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{one40_proof}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["reddavis"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-15}
|
13
13
|
s.description = %q{A Ruby wrapper around the 140Proof API. Documentation can be found here - http://developers.140proof.com/docs/}
|
14
14
|
s.email = %q{reddavis@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -37,6 +37,8 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/one40_proof/simple/test.rb",
|
38
38
|
"lib/one40_proof/simple/user_ad.rb",
|
39
39
|
"one40_proof.gemspec",
|
40
|
+
"spec/fixtures/test",
|
41
|
+
"spec/fixtures/user",
|
40
42
|
"spec/one40_proof/attributes/action_urls_spec.rb",
|
41
43
|
"spec/one40_proof/attributes/ad_spec.rb",
|
42
44
|
"spec/one40_proof/attributes/status_spec.rb",
|
data/spec/fixtures/test
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"ads":[{"status":{"id":6017128450},"byline":"ads by 140 Proof","text":"NEW #Mets 2010 Alternate Jersey can be ordered here --> http://bit.ly/8P6xYm","action_urls":{"click_url":"http://api.140proof.com/clicks/create.json?ad_id=1&impression_id=1&app_id=test&user_id=7","favorite_url":"http://api.140proof.com/favorites/create.json?ad_id=1&impression_id=1&app_id=test&user_id=7","impression_url":"http://api.140proof.com/impressions/verify.json?ad_id=1&impression_id=1&app_id=test&user_id=7","friendship_url":"http://api.140proof.com/friendships/create.json?ad_id=1&impression_id=1&app_id=test&user_id=7","reply_url":"http://api.140proof.com/replies/create.json?ad_id=1&impression_id=1&app_id=test&user_id=7","retweet_url":"http://api.140proof.com/retweets/create.json?ad_id=1&impression_id=1&app_id=test&user_id=7"},"user":{"profile_image_url":"http://img.tweetimag.es/i/Mets_n","name":"New York Mets","id":39367703,"screen_name":"Mets"},"image_url":"http://img.tweetimag.es/i/mets_b"}]}
|
data/spec/fixtures/user
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"ads":[{"status":{"id":null},"byline":"ads by 140 Proof","text":"Serving up farm-fresh soul food and San Francisco's finest chicken and waffles. Follow @LittleSkillet for today's specials.","action_urls":{"click_url":"http://api.140proof.com/clicks/create.json?ad_id=295&impression_id=7933117&app_id=test&user_id=7505382","favorite_url":null,"impression_url":"http://api.140proof.com/impressions/verify.json?ad_id=295&impression_id=7933117&app_id=test&user_id=7505382","friendship_url":"http://api.140proof.com/friendships/create.json?ad_id=295&impression_id=7933117&app_id=test&user_id=7505382","reply_url":"http://api.140proof.com/replies/create.json?ad_id=295&impression_id=7933117&app_id=test&user_id=7505382","retweet_url":null},"user":{"profile_image_url":"http://img.tweetimag.es/i/LittleSkillet_n","name":"Little Skillet","id":27710301,"screen_name":"LittleSkillet"},"image_url":"http://img.tweetimag.es/i/LittleSkillet_n"}]}
|
@@ -29,4 +29,11 @@ describe "Ad" do
|
|
29
29
|
it "should return a Status object" do
|
30
30
|
@ad.status.should be_a(One40Proof::Status)
|
31
31
|
end
|
32
|
+
|
33
|
+
it "should send a get request to action_urls.impression_url" do
|
34
|
+
stub_request(:get, @ad.action_urls.impression_url)
|
35
|
+
@ad.validate_impression!
|
36
|
+
|
37
|
+
WebMock.should have_requested(:get, @ad.action_urls.impression_url)
|
38
|
+
end
|
32
39
|
end
|
@@ -32,6 +32,13 @@ describe "Base" do
|
|
32
32
|
it "should return text" do
|
33
33
|
@base.text.should == "Serving up farm-fresh soul food and San Francisco's finest chicken and waffles. Follow @LittleSkillet for today's specials."
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should send a get request to action_urls.impression_url" do
|
37
|
+
stub_request(:get, @base.action_urls.impression_url)
|
38
|
+
@base.validate_impression!
|
39
|
+
|
40
|
+
WebMock.should have_requested(:get, @base.action_urls.impression_url)
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
describe "404" do
|
@@ -43,5 +50,4 @@ describe "Base" do
|
|
43
50
|
end.should raise_error(One40Proof::NotFound)
|
44
51
|
end
|
45
52
|
end
|
46
|
-
|
47
53
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,14 +13,18 @@ end
|
|
13
13
|
|
14
14
|
# From http://api.140proof.com/test/ads.json
|
15
15
|
def test_ad_data
|
16
|
-
|
16
|
+
fixture('test')
|
17
17
|
end
|
18
18
|
|
19
19
|
# From http://api.140proof.com/ads/user.json?user_id=sferik&app_id=test
|
20
20
|
def user_ad_data
|
21
|
-
|
21
|
+
fixture('user')
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
def fixture(name)
|
25
|
+
file = File.dirname(__FILE__) + "/fixtures/#{name}"
|
26
|
+
File.read(file)
|
26
27
|
end
|
28
|
+
|
29
|
+
Spec::Runner.configure do |config|
|
30
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- reddavis
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-15 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,8 @@ files:
|
|
85
85
|
- lib/one40_proof/simple/test.rb
|
86
86
|
- lib/one40_proof/simple/user_ad.rb
|
87
87
|
- one40_proof.gemspec
|
88
|
+
- spec/fixtures/test
|
89
|
+
- spec/fixtures/user
|
88
90
|
- spec/one40_proof/attributes/action_urls_spec.rb
|
89
91
|
- spec/one40_proof/attributes/ad_spec.rb
|
90
92
|
- spec/one40_proof/attributes/status_spec.rb
|