qbo_api 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75ebf34a99af284ed063c84228d3b1ddcfff3f2e
4
- data.tar.gz: 8cccbbf2339e2469cd1b9d36ebdb1fea578569c1
3
+ metadata.gz: 08dbbbedc1e37cfbad306aba463253f581e9e4c4
4
+ data.tar.gz: 64d8f03692b8e77db74e875f5bf54d5b2972b46f
5
5
  SHA512:
6
- metadata.gz: d2e05d83c0d89db9f6a554bbd2d5b36c0a22d5e1370e6a2ba8ba2327eb7b88e8f74e25bc8a5eaaaab05a36ab674fdeb9c9495c63a31e2034c6862a3be7e34d1f
7
- data.tar.gz: 907d9fda2554582e70647cab5b8da130f721ffc71e07192ed6915dff3e95028ac24f92ace2f77d73dfe5c100bfa4574932957ee52d74ffc995bf5530232c0586
6
+ metadata.gz: f244c4a525ebcf4b6f894a392e391af4286a64086e145ea5eed23d614f7248ccc415be2a1faad5672e1dfff39c116b688c7866d28dbfffe8389a9996863cafbb
7
+ data.tar.gz: 1d4b41dfbc68fe0d1794d2a0a508b4fb26bbade1fd5e1866ec9c4915ffc2d242238c856dbc847a7cba7f1d8857fa0daf30b6a7f6920aaf1ee2cd755bd1afcc33
data/README.md CHANGED
@@ -107,7 +107,8 @@ QboApi.logger = Rails.logger
107
107
 
108
108
  ### Change data capture (CDC) query
109
109
  ```ruby
110
- response = api.cdc('estimate&changedSince=2011-10-10T09:00:00-07:00')
110
+ response = api.cdc(entities: 'estimate', changed_since: '2011-10-10T09:00:00-07:00')
111
+ # You can also send in a Time object e.g. changed_since: Time.now
111
112
  expect(response['CDCResponse'].size).to eq 1
112
113
  ids = response['CDCResponse'][0]['QueryResponse'][0]['Estimate'].collect{ |e| e['Id'] }
113
114
  p ids
@@ -9,10 +9,12 @@ require_relative 'qbo_api/configuration'
9
9
  require_relative 'qbo_api/error'
10
10
  require_relative 'qbo_api/raise_http_exception'
11
11
  require_relative 'qbo_api/entity'
12
+ require_relative 'qbo_api/util'
12
13
 
13
14
  class QboApi
14
15
  extend Configuration
15
16
  include Entity
17
+ include Util
16
18
  attr_reader :realm_id
17
19
 
18
20
  REQUEST_TOKEN_URL = 'https://oauth.intuit.com/oauth/v1/get_request_token'
@@ -51,8 +53,8 @@ class QboApi
51
53
  request(:get, entity: entity, path: path)
52
54
  end
53
55
 
54
- def cdc(query)
55
- path = "#{realm_id}/cdc?entities=#{query}"
56
+ def cdc(entities:, changed_since:)
57
+ path = "#{realm_id}/cdc?entities=#{entities}&changedSince=#{cdc_time(changed_since)}"
56
58
  request(:get, path: path)
57
59
  end
58
60
 
@@ -0,0 +1,12 @@
1
+ class QboApi
2
+ module Util
3
+ def cdc_time(time)
4
+ if time.is_a?(String)
5
+ time
6
+ else
7
+ time.to_s.sub(' ', 'TO').sub(' ', '').insert(-3, ':')
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,3 +1,3 @@
1
1
  class QboApi
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qbo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Pelczarski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -229,6 +229,7 @@ files:
229
229
  - lib/qbo_api/entity.rb
230
230
  - lib/qbo_api/error.rb
231
231
  - lib/qbo_api/raise_http_exception.rb
232
+ - lib/qbo_api/util.rb
232
233
  - lib/qbo_api/version.rb
233
234
  - qbo_api.gemspec
234
235
  homepage: https://github.com/minimul/qbo_api