adcloud 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/RELEASE_NOTES.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Release Notes
2
2
  =============
3
3
 
4
+ ### 0.7.5
5
+
6
+ * Reports booking has been renamed to campaign
7
+ * Allow to change campaigns to offer state with ```campaign.offer!```
8
+
4
9
  ### 0.7.4
5
10
 
6
11
  * Allow fetching all reports for a date ```find_all_by_date```
@@ -51,7 +51,6 @@ module Adcloud
51
51
  attribute :has_end_date, Boolean
52
52
  attribute :modified, DateTime
53
53
  attribute :created, DateTime
54
- # attribute :fixed_price, # missing
55
54
 
56
55
  # @return [void] Validate the campaign against the api
57
56
  def validate
@@ -73,6 +72,11 @@ module Adcloud
73
72
  result && result["_meta"] && result["_meta"]["status"] == 200 || false
74
73
  end
75
74
 
75
+ def offer!
76
+ result = connection.put("campaigns/#{self.id}/offer")
77
+ result && result["_meta"] && result["_meta"]["status"] == 200 || false
78
+ end
79
+
76
80
  # @return [Boolean] True when campaign is valid - otherwise false
77
81
  def valid?
78
82
  self.validate
@@ -9,7 +9,7 @@ module Adcloud
9
9
  attr_accessor :api_endpoint, :connection
10
10
 
11
11
  def find_by_date(date)
12
- result = connection.get(self.api_endpoint, { filter: { date: date.to_s } })
12
+ result = connection.get(self.api_endpoint, { filter: { date: date.to_s }, new_backend: true })
13
13
  return self.new(result)
14
14
  end
15
15
 
@@ -22,7 +22,7 @@ module Adcloud
22
22
  begin
23
23
  begin
24
24
  page += 1
25
- raw_result = connection.get(self.api_endpoint, { filter: { date: date.to_s }, :page => page, :per_page => Entity::MAX_PER_PAGE })
25
+ raw_result = connection.get(self.api_endpoint, { filter: { date: date.to_s }, :page => page, :per_page => Entity::MAX_PER_PAGE, new_backend: true })
26
26
  total_pages = raw_result['_meta']['total_pages']
27
27
  page_result = self.new(raw_result)
28
28
  paged_items += page_result.items
@@ -8,7 +8,7 @@ module Adcloud
8
8
  attribute :ad_placement_id, Integer
9
9
  attribute :product_id, Integer
10
10
  attribute :ad_id, Integer
11
- attribute :booking_id, Integer
11
+ attribute :campaign_id, Integer
12
12
  attribute :page_type, Integer
13
13
  attribute :ad_position, Integer
14
14
  attribute :ad_count, Integer
@@ -31,7 +31,7 @@ module Adcloud
31
31
  attribute :design, String
32
32
  attribute :topic, String
33
33
  attribute :ad, String
34
- attribute :booking, String
34
+ attribute :campaign, String
35
35
  attribute :product, String
36
36
  attribute :ad_impressions_costs, Float
37
37
  attribute :clicks_costs, Float
@@ -1,3 +1,3 @@
1
1
  module Adcloud
2
- VERSION = '0.7.4'
2
+ VERSION = '0.7.5'
3
3
  end
@@ -83,4 +83,20 @@ describe Adcloud::Campaign do
83
83
  end
84
84
  end
85
85
 
86
+ describe '#end!' do
87
+ before { campaign.id = 123 }
88
+
89
+ it 'is true when the state has changed' do
90
+ response_data = {'_meta' => { 'status' => 200, 'message' => 'status changed' } }
91
+ connection.expects(:put).with('campaigns/123/offer').returns(response_data)
92
+ campaign.offer!.must_equal true
93
+ end
94
+
95
+ it 'is false when the state could not be changed' do
96
+ response_data = {'_meta' => { 'status' => 400, 'message' => 'bad request' } }
97
+ connection.expects(:put).with('campaigns/123/offer').returns(response_data)
98
+ campaign.offer!.must_equal false
99
+ end
100
+ end
101
+
86
102
  end
@@ -15,7 +15,7 @@ describe Adcloud::Report do
15
15
  end
16
16
 
17
17
  it 'access the api at the correct path' do
18
- subject.connection.expects(:get).with('reports/advertiser', { filter: { date: '1981-06-21' } })
18
+ subject.connection.expects(:get).with('reports/advertiser', { filter: { date: '1981-06-21' }, new_backend: true })
19
19
  subject.find_by_date(Date.new(1981, 06, 21))
20
20
  end
21
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-10 00:00:00.000000000 Z
13
+ date: 2012-10-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest