Skip to content

Commit c41fb1f

Browse files
committed
correctly identify the library in User-Agent
1 parent 34c28e5 commit c41fb1f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/contacts.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
require 'contacts/version'
2+
13
module Contacts
4+
Identifier = 'Ruby Contacts v' + VERSION::STRING
5+
26
class Contact
37
attr_reader :name, :username, :emails
48

lib/contacts/google.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def initialize(token, user_id = 'default', client = false)
119119
@token = token.to_s
120120
@headers = {
121121
'Accept-Encoding' => 'gzip',
122-
'User-Agent' => 'agent-that-accepts-gzip'
122+
'User-Agent' => Identifier + ' (gzip)'
123123
}.update(self.class.authorization_header(@token, client))
124124
@projection = 'thin'
125125
end

spec/gmail/fetching_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
connection.expects(:get).with('/m8/feeds/contacts/default/thin?foo=bar', {
1717
'Authorization' => %(AuthSub token="dummytoken"),
1818
'Accept-Encoding' => 'gzip',
19-
'User-Agent' => 'agent-that-accepts-gzip'
19+
'User-Agent' => "Ruby Contacts v#{Contacts::VERSION::STRING} (gzip)"
2020
}).returns(response)
2121

2222
@gmail.get(:foo => 'bar')

0 commit comments

Comments
 (0)