infusionsoft 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'infusionsoft/version'
2
+
1
3
  module Infusionsoft
2
4
 
3
5
  module Configuration
@@ -5,7 +7,8 @@ module Infusionsoft
5
7
  VALID_OPTION_KEYS = [
6
8
  :api_url,
7
9
  :api_key,
8
- :api_logger
10
+ :api_logger,
11
+ :user_agent # allows you to change the User-Agent of the request headers
9
12
  ].freeze
10
13
 
11
14
  # @private
@@ -33,6 +36,10 @@ module Infusionsoft
33
36
  #self.api_key = 'na'
34
37
  #end
35
38
 
39
+ def user_agent
40
+ @user_agent ||= "Infusionsoft-#{VERSION} (RubyGem)"
41
+ end
42
+
36
43
  def api_logger
37
44
  @api_logger || Infusionsoft::APILogger.new
38
45
  end
@@ -6,15 +6,16 @@ module Infusionsoft
6
6
  private
7
7
 
8
8
  def connection(service_call, *args)
9
- server = XMLRPC::Client.new3({
9
+ client = XMLRPC::Client.new3({
10
10
  'host' => api_url,
11
11
  'path' => "/api/xmlrpc",
12
12
  'port' => 443,
13
13
  'use_ssl' => true
14
14
  })
15
+ client.http_header_extra = {'User-Agent' => user_agent}
15
16
  begin
16
17
  api_logger.info "CALL: #{service_call} api_key:#{api_key} at:#{Time.now} args:#{args.inspect}"
17
- result = server.call("#{service_call}", api_key, *args)
18
+ result = client.call("#{service_call}", api_key, *args)
18
19
  if result.nil?; ok_to_retry('nil response') end
19
20
  rescue Timeout::Error => timeout
20
21
  # Retry up to 5 times on a Timeout before raising it
@@ -1,4 +1,4 @@
1
1
  module Infusionsoft
2
2
  # The version of the gem
3
- VERSION = '1.1.7'.freeze unless defined?(::Infusionsoft::VERSION)
3
+ VERSION = '1.1.8'.freeze unless defined?(::Infusionsoft::VERSION)
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infusionsoft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-10 00:00:00.000000000 Z
12
+ date: 2014-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake