quickbase_client 1.0.24 → 1.0.25

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.
Files changed (5) hide show
  1. checksums.yaml +6 -14
  2. data/CHANGES +2 -0
  3. data/README.rdoc +3 -1
  4. data/lib/QuickBaseClient.rb +30 -32
  5. metadata +11 -11
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWVlOGRmZDVlOTU2ODM5ZjRiN2I1NGMxNDgwMjYzYTBhM2MwYTMwNw==
5
- data.tar.gz: !binary |-
6
- ZjlmMzViNWFlNWRhZjI0YjcxNjY0Y2M4OTgyODU0YWI4MDJiNGZhNw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YjQ2ZDIyNjI5YzE5M2IzNzVjYjVkOTRjY2M4MjVhNWQ5NDZmNTdjNzZlOTBh
10
- MmJlYzljOTgyNjFmMDI4ZmQwN2E4YjRlMmUzNTkzMmUxYmIwMzY0OTgzNWM3
11
- NjQ5NzJlMTU0ZjYwYjI3YThlZjgyZGZhNDgxNjFlNzIyZTVhNDE=
12
- data.tar.gz: !binary |-
13
- ZjU4M2ExYjdjMGM4MmVlOWQ2MjA3ZmEyMDBjZGNlNWVhYTJkZWQzYmUxYjA1
14
- NGM5MjBhYmIxMDEwN2FiOTUwMmZkN2Q5M2UyZmU2ZWQ2YWI0MjM3MDUwMGQy
15
- ODhkYmM0NjdkY2Q2Nzg4OWNmYWVjNzRhMDU2MjNmYmVhNzA0YjU=
2
+ SHA1:
3
+ metadata.gz: 714fce187692d8bb1b7cf91484a8c51da434b657
4
+ data.tar.gz: 2c5e045b86ca2413d648f05aaa90a9816e81f26a
5
+ SHA512:
6
+ metadata.gz: 0356a69b2e9e041ada7cff20eab5cea47b2307ac7d2837e94f53cc59afb5dd90a3b2f2205fc77af48f04a081c0b4b5230cce99d4c02c90fe040f1ab37736505a
7
+ data.tar.gz: 7fccba5e7ee75a48d5bbad2fee098ad28f0688403dbf0eeac6a4b84365db59a91114f045a30e54a8850a438674f791a19f3d0a642880ea5585ebd240e3e444ef
data/CHANGES CHANGED
@@ -1,5 +1,7 @@
1
1
  == Change History
2
2
 
3
+ 1.0.25 - 05/24/2017 - Merged in changes. See github.
4
+
3
5
  1.0.24 - 03/15/2013 - Improved getRealmForDbid(dbid)
4
6
 
5
7
  1.0.23 - 03/11/2013 - Added getRealmForDbid(dbid)
data/README.rdoc CHANGED
@@ -28,6 +28,8 @@ More information about the QuickBase Client is available here -
28
28
 
29
29
  == Change History
30
30
 
31
+ 1.0.25 - 05/24/2017 - Merged in changes. See github.
32
+
31
33
  1.0.24 - 03/15/2013 - Improved getRealmForDbid(dbid)
32
34
 
33
35
  1.0.23 - 03/11/2013 - Added getRealmForDbid(dbid)
@@ -60,7 +62,7 @@ Please submit questions, feedback, suggestions on Intuit's Community Forum at ht
60
62
 
61
63
  == License
62
64
 
63
- Copyright (c) 2009-2012 Gareth Lewis and Intuit, Inc.
65
+ Copyright (c) 2009-2013 Gareth Lewis
64
66
 
65
67
  All rights reserved. This program and the accompanying materials
66
68
  are made available under the terms of the Eclipse Public License v1.0
@@ -15,6 +15,7 @@ require 'rexml/document'
15
15
  require 'net/https'
16
16
  require 'json'
17
17
  require 'QuickBaseMisc'
18
+ require 'csv'
18
19
 
19
20
  begin
20
21
  require 'httpclient'
@@ -62,7 +63,7 @@ class Client
62
63
  attr_reader :eventSubscribers, :logger
63
64
 
64
65
  attr_writer :cacheSchemas, :apptoken, :escapeBR, :fvlist, :httpConnection, :ignoreCR, :ignoreLF, :ignoreTAB
65
- attr_writer :printRequestsAndResponses, :qbhost, :stopOnError, :ticket, :udata, :rdr, :xsl, :encoding
66
+ attr_writer :printRequestsAndResponses, :qbhost, :stopOnError, :ticket, :udata, :rdr, :xsl, :encoding, :usertoken
66
67
 
67
68
  =begin rdoc
68
69
  'Plumbing' methods:
@@ -90,12 +91,14 @@ class Client
90
91
  apptoken = nil,
91
92
  debugHTTPConnection = false,
92
93
  domain = "quickbase",
93
- proxy_options = nil
94
+ proxy_options = nil,
95
+ usertoken = nil
94
96
  )
95
97
  begin
96
98
  @org = org ? org : "www"
97
99
  @domain = domain ? domain : "quickbase"
98
100
  @apptoken = apptoken
101
+ @usertoken = usertoken
99
102
  @printRequestsAndResponses = printRequestsAndResponses
100
103
  @stopOnError = stopOnError
101
104
  @escapeBR = @ignoreCR = @ignoreLF = @ignoreTAB = true
@@ -103,15 +106,12 @@ class Client
103
106
  setHTTPConnectionAndqbhost( useSSL, org, domain, proxy_options )
104
107
  debugHTTPConnection() if debugHTTPConnection
105
108
  @standardRequestHeaders = { "Content-Type" => "application/xml" }
106
- if username and password
107
- authenticate( username, password )
108
109
  if appname and @errcode == "0"
109
110
  findDBByname( appname )
110
111
  if @dbid and @errcode == "0"
111
112
  getDBInfo( @dbid )
112
113
  getSchema( @dbid )
113
114
  end
114
- end
115
115
  end
116
116
  rescue Net::HTTPBadRequest => @lastError
117
117
  rescue Net::HTTPBadResponse => @lastError
@@ -145,7 +145,8 @@ class Client
145
145
  options["apptoken"],
146
146
  options["debugHTTPConnection"],
147
147
  options["domain"],
148
- options["proxy_options"])
148
+ options["proxy_options"],
149
+ options["usertoken"])
149
150
  end
150
151
 
151
152
  # Initializes the connection to QuickBase.
@@ -292,7 +293,7 @@ class Client
292
293
  case api_Request
293
294
  when :getAppDTMInfo
294
295
  @dbidForRequestURL = "/db/main?a=#{:getAppDTMInfo}&dbid=#{@dbid}"
295
- when :authenticate, :createDatabase, :deleteAppZip, :dumpAppZip, :getUserInfo, :findDBByname, :getOneTimeTicket, :getFileUploadToken, :grantedDBs, :installAppZip, :obStatus, :signOut
296
+ when :authenticate, :createDatabase, :deleteAppZip, :dumpAppZip, :getUserInfo, :findDBByname, :GrantedDBs, :getOneTimeTicket, :getFileUploadToken, :grantedDBs, :installAppZip, :obStatus, :signOut
296
297
  @dbidForRequestURL = "/db/main"
297
298
  end
298
299
  end
@@ -301,12 +302,7 @@ class Client
301
302
  # The XML includes a apptoken if one has been set.
302
303
  def getAuthenticationXMLforRequest( api_Request )
303
304
  @authenticationXML = ""
304
- if @ticket
305
- @authenticationXML = toXML( :ticket, @ticket )
306
- elsif @username and @password
307
- @authenticationXML = toXML( :username, @username ) + toXML( :password, @password )
308
- end
309
- @authenticationXML << toXML( :apptoken, @apptoken ) if @apptoken
305
+ @authenticationXML = toXML( :usertoken, @usertoken )
310
306
  end
311
307
 
312
308
  # Returns whether a request will return HTML rather than XML.
@@ -443,6 +439,19 @@ class Client
443
439
  @fieldValue
444
440
  end
445
441
 
442
+ #Gets a dbid at an Xpath in the XML from specified dbName of Quickbase
443
+ def getResponsePathValueByDBName ( path, dbName)
444
+ @fieldValue = ""
445
+ if path and @responseXMLdoc
446
+ e = @responseXMLdoc.root.elements[ path.to_s ]
447
+ end
448
+ e.each { |e|
449
+ if e and e.is_a?( REXML::Element ) and e.dbinfo.dbname == dbName
450
+ return e.dbinfo.dbid
451
+ end
452
+ }
453
+ @fieldValue
454
+ end
446
455
  # Gets an array of elements at an Xpath in the XML from QuickBase.
447
456
  def getResponseElements( path )
448
457
  if path and @responseXMLdoc
@@ -1020,8 +1029,8 @@ class Client
1020
1029
  resp = httpclient.get("https://www.quickbase.com/db/#{dbid}")
1021
1030
  location = resp.header['Location'][0]
1022
1031
  location.sub!("https://","")
1023
- parts = location.split(/\./)
1024
- @realm = parts[0]
1032
+ parts = location.split(/\./)
1033
+ @realm = parts[0]
1025
1034
  rescue StandardError => error
1026
1035
  @realm = nil
1027
1036
  end
@@ -1495,20 +1504,8 @@ class Client
1495
1504
 
1496
1505
  # Converts a string into an array, given a field separator.
1497
1506
  # '"' followed by the field separator are treated the same way as just the field separator.
1498
- def splitString( string, fieldSeparator = "," )
1499
- ra = []
1500
- string.chomp!
1501
- if string.include?( "\"" )
1502
- a=string.split( "\"#{fieldSeparator}" )
1503
- a.each{ |b| c=b.split( "#{fieldSeparator}\"" )
1504
- c.each{ |d|
1505
- ra << d
1506
- }
1507
- }
1508
- else
1509
- ra = string.split( fieldSeparator )
1510
- end
1511
- ra
1507
+ def splitString(string, fieldSeparator = ",")
1508
+ CSV.parse(string, col_sep: fieldSeparator).shift
1512
1509
  end
1513
1510
 
1514
1511
  # Returns the URL-encoded version of a non-printing character.
@@ -2339,8 +2336,8 @@ class Client
2339
2336
  @dbname = dbname
2340
2337
  xmlRequestData = toXML( :dbname, @dbname )
2341
2338
 
2342
- sendRequest( :findDBByname, xmlRequestData )
2343
- @dbid = getResponseValue( :dbid )
2339
+ sendRequest( :GrantedDBs, xmlRequestData )
2340
+ @dbid = getResponsePathValueByDBName( 'databases', dbname )
2344
2341
 
2345
2342
  return self if @chainAPIcalls
2346
2343
  @dbid
@@ -3086,10 +3083,11 @@ class Client
3086
3083
  # Use this if you aren't sure whether a particular record already exists or not
3087
3084
  def addOrEditRecord( dbid, fvlist, rid = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil, key = nil )
3088
3085
  if rid or key
3089
- editRecord( dbid, rid, fvlist, disprec, fform, ignoreError, update_id, key )
3086
+ record = editRecord( dbid, rid, fvlist, disprec, fform, ignoreError, update_id, key )
3090
3087
  if !@requestSucceeded
3091
3088
  addRecord( dbid, fvlist, disprec, fform, ignoreError, update_id )
3092
3089
  end
3090
+ record
3093
3091
  else
3094
3092
  addRecord( dbid, fvlist, disprec, fform, ignoreError, update_id )
3095
3093
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbase_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.24
4
+ version: 1.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth Lewis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-15 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Wraps the QuickBase HTTP API and adds classes and methods to minimize
14
14
  the amount of code needed to get useful things done.
@@ -20,7 +20,7 @@ extra_rdoc_files:
20
20
  - LICENSE
21
21
  - README.rdoc
22
22
  files:
23
- - .yardopts
23
+ - ".yardopts"
24
24
  - CHANGES
25
25
  - LICENSE
26
26
  - README.rdoc
@@ -32,12 +32,12 @@ licenses: []
32
32
  metadata: {}
33
33
  post_install_message:
34
34
  rdoc_options:
35
- - --line-numbers
36
- - --inline-source
37
- - --main
35
+ - "--line-numbers"
36
+ - "--inline-source"
37
+ - "--main"
38
38
  - README.rdoc
39
- - --title
40
- - ! 'quickbase: Ruby client for database applications on www.quickbase.com'
39
+ - "--title"
40
+ - 'quickbase: Ruby client for database applications on www.quickbase.com'
41
41
  - lib/QuickBaseClient.rb
42
42
  - lib/QuickBaseMisc.rb
43
43
  - lib/quickbase_client.rb
@@ -45,17 +45,17 @@ require_paths:
45
45
  - lib
46
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ! '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: 1.8.6
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project: orphans
58
- rubygems_version: 2.0.2
58
+ rubygems_version: 2.6.12
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Ruby wrapper for the QuickBase HTTP API.