rubicon-api-client 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubicon-api-client.rb +8 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4e1742601b70cace1ed97db21bafc6d567150be
4
- data.tar.gz: 114e2d6d8dda79f88adefc34fdd669e70ef75094
3
+ metadata.gz: cc74a48968be1681922550f62ff3e9f7b0fcda87
4
+ data.tar.gz: bdfa1464742fa94e46d60d7a1a33c6448415345a
5
5
  SHA512:
6
- metadata.gz: 67e9c27289e6b00d531dcda0920602868fd416e824191fd7f6dfb49dc948ef24d3df6e8e4ad761d32a23086a6fecb3351a429398cb33441d4d7d60e6817c7f14
7
- data.tar.gz: b1690674313be31c21865de0e09ed406246112646f2dca903850435890e442b577128e41058566bfe39f74feb8ba1a297c70e4d975af4a52f1dcb829330b9295
6
+ metadata.gz: 7e52c8e27e2860091c0986e0d8a0cd421d576efb272ed74e954d43f1235b732f011f131589b8cdecc555a7c38a2a2c303c3ccc8de6055fba7edf9eddae4db5ff
7
+ data.tar.gz: d401e66562325997bf2a6574acf1c520cb763cabb3b0f82f8c25a981ada39b0a097d9f5f250c055b1ab1941216c820eaa36f6401f358f9258b0a87341ac9f49d
@@ -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[0].to_s).to_s
60
+ args['end'] = Date.parse(date_range_splat[1].to_s).to_s
55
61
  end
56
62
  args
57
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubicon-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hagen