rubicon-api-client 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/rubicon-api-client.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc74a48968be1681922550f62ff3e9f7b0fcda87
|
4
|
+
data.tar.gz: bdfa1464742fa94e46d60d7a1a33c6448415345a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e52c8e27e2860091c0986e0d8a0cd421d576efb272ed74e954d43f1235b732f011f131589b8cdecc555a7c38a2a2c303c3ccc8de6055fba7edf9eddae4db5ff
|
7
|
+
data.tar.gz: d401e66562325997bf2a6574acf1c520cb763cabb3b0f82f8c25a981ada39b0a097d9f5f250c055b1ab1941216c820eaa36f6401f358f9258b0a87341ac9f49d
|
data/lib/rubicon-api-client.rb
CHANGED
@@ -10,11 +10,16 @@ module RubiconApiClient
|
|
10
10
|
['today', 'yesterday', 'this week', 'last week', 'this month', 'last month', 'this year', 'last 7', 'last 30', 'all']
|
11
11
|
end
|
12
12
|
|
13
|
+
def response_formats
|
14
|
+
{ :xml => 'application/xml', :json => 'application/json', :csv => 'text/csv' }
|
15
|
+
end
|
16
|
+
|
13
17
|
|
14
|
-
def initialize(id, key, secret)
|
18
|
+
def initialize(id, key, secret, format=:xml)
|
15
19
|
@id = id
|
16
20
|
@key = key
|
17
21
|
@secret = secret
|
22
|
+
@response_format = response_formats[format]
|
18
23
|
end
|
19
24
|
|
20
25
|
def execute(path)
|
@@ -32,6 +37,7 @@ module RubiconApiClient
|
|
32
37
|
auth = Net::HTTP::DigestAuth.new.auth_header uri, res['www-authenticate'], 'GET'
|
33
38
|
req = Net::HTTP::Get.new path
|
34
39
|
req.add_field 'Authorization', auth
|
40
|
+
req['Accept'] = @response_format
|
35
41
|
res = net.request req
|
36
42
|
res.read_body
|
37
43
|
end
|
@@ -51,7 +57,7 @@ module RubiconApiClient
|
|
51
57
|
args['when'] = date_range_splat[0].to_s
|
52
58
|
elsif date_range_splat.length == 2
|
53
59
|
args['start'] = Date.parse(date_range_splat[0].to_s).to_s
|
54
|
-
args['end'] = Date.parse(date_range_splat[
|
60
|
+
args['end'] = Date.parse(date_range_splat[1].to_s).to_s
|
55
61
|
end
|
56
62
|
args
|
57
63
|
end
|