xero_gateway-float 2.0.17 → 2.0.18

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.
@@ -16,7 +16,7 @@ module XeroGateway
16
16
  @xero_url = options[:xero_url] || "https://api.xero.com/api.xro/2.0"
17
17
  @client = OAuth.new(consumer_key, consumer_secret, options)
18
18
  end
19
-
19
+
20
20
  #
21
21
  # Retrieve all contacts from Xero
22
22
  #
@@ -4,18 +4,24 @@ module XeroGateway
4
4
  READ_TIMEOUT = 60 unless defined? READ_TIMEOUT
5
5
  ROOT_CA_FILE = File.join(File.dirname(__FILE__), 'ca-certificates.crt') unless defined? ROOT_CA_FILE
6
6
 
7
+ def log(str)
8
+ XeroGateway.log("HTTP : "+str)
9
+ end
7
10
  def http_get(client, url, extra_params = {})
11
+ log "get | #{url} :: #{extra_params.inspect}"
8
12
  http_request(client, :get, url, nil, extra_params)
9
13
  end
10
14
 
11
15
  def http_post(client, url, body, extra_params = {})
16
+ log "post | #{url} :: #{extra_params.inspect}"
12
17
  http_request(client, :post, url, body, extra_params)
13
18
  end
14
19
 
15
20
  def http_put(client, url, body, extra_params = {})
21
+ log "put | #{url} :: #{extra_params.inspect}"
16
22
  http_request(client, :put, url, body, extra_params)
17
23
  end
18
-
24
+
19
25
  private
20
26
 
21
27
  def http_request(client, method, url, body, params = {})
@@ -0,0 +1,15 @@
1
+ module XeroGateway
2
+ def self.debug=(val)
3
+ @debug = !!val
4
+ end
5
+ def self.debugging?
6
+ !!@debug
7
+ end
8
+
9
+ def self.log(message)
10
+ if debugging?
11
+ puts "XeroGateway" + " | " + message
12
+ end
13
+ end
14
+ end
15
+
data/lib/xero_gateway.rb CHANGED
@@ -11,6 +11,7 @@ require "active_support/all"
11
11
 
12
12
  require File.join(File.dirname(__FILE__), 'oauth', 'oauth_consumer')
13
13
 
14
+ require File.join(File.dirname(__FILE__), 'xero_gateway', 'xero_gateway_debug')
14
15
  require File.join(File.dirname(__FILE__), 'xero_gateway', 'http_encoding_helper')
15
16
  require File.join(File.dirname(__FILE__), 'xero_gateway', 'http')
16
17
  require File.join(File.dirname(__FILE__), 'xero_gateway', 'dates')
data/xero_gateway.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xero_gateway-float"
3
- s.version = "2.0.17"
4
- s.date = "2012-12-18"
3
+ s.version = "2.0.18"
4
+ s.date = "2013-01-17"
5
5
  s.summary = "Enables ruby based applications to communicate with the Xero API"
6
6
  s.email = "tim@connorsoftware.com"
7
7
  s.homepage = "http://github.com/latentflip/xero_gateway"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xero_gateway-float
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.17
4
+ version: 2.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-18 00:00:00.000000000 Z
14
+ date: 2013-01-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: builder
@@ -102,6 +102,7 @@ files:
102
102
  - lib/xero_gateway/response.rb
103
103
  - lib/xero_gateway/tax_rate.rb
104
104
  - lib/xero_gateway/tracking_category.rb
105
+ - lib/xero_gateway/xero_gateway_debug.rb
105
106
  - lib/xero_gateway.rb
106
107
  - test/integration/accounts_list_test.rb
107
108
  - test/integration/create_bank_transaction_test.rb