nssql 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 29284906429e7ba1a341a0da360a5ba9e654bff1a0f09f4e27497ce0ca5bc297
4
- data.tar.gz: 8523783c568694450af7c5c88d5172a3f14aca79b9f841994dca151a2e6558cd
3
+ metadata.gz: 29a14e303af8a7a3adf5bd10c115095f2690c1dde7d7b9bca930f669e3b279fb
4
+ data.tar.gz: fbd6d7e0032ed00f4a12dc6bc3032aea5b0b135935b703c64de14a44fda0bfe1
5
5
  SHA512:
6
- metadata.gz: 59cebec72fa7f9dd1ab48d015a3ab98bd1fe79bc6bd0f8d201922fb2903599c13da6deb8dbce2dd7418c261de29066052da4b6940876719f922592649ca54241
7
- data.tar.gz: 58eb26419ded890eea6f689264958d8abb9c84f78007e1f809ca49e9a1c5269f98bc8f4fbf4d2ec75a1663f55bbfa3770eedbee16d245dabb5d13e03891f47fb
6
+ metadata.gz: 2f112c9987540c853e48ff1fc3f41c2c9fe1f281675eec16d27e9366ee8c75fb3dd1886df23240ef968bccdf100d93cac8bc629f99df2b169776fb9cfcadfbff
7
+ data.tar.gz: b2baa0aaf4a14a71bad05f8fe50ac1a89e86b0bf46e38b23dd3d9a3219032d11097737932679ebd49d2924fd58d75131e485a89d4538593a0ccc60127cda0a52
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.1 (2019-04-08)
2
+
3
+ - Now possible to get `table_name`, `primary_keys`, and `column` from a `NSSQL::Table`
4
+ - Fixes problem with `NSSQL.select_array` method
5
+
1
6
  ## 0.1.0 (2019-04-08)
2
7
 
3
8
  - Initial release
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # NSSQL
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/nssql.svg)](https://badge.fury.io/rb/nssql)
3
4
  [![Build Status](https://travis-ci.org/apoex/nssql.svg?branch=master)](https://travis-ci.org/apoex/nssql)
4
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/0bc97f0e7fef36bcf922/maintainability)](https://codeclimate.com/github/apoex/nssql/maintainability)
5
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/0bc97f0e7fef36bcf922/test_coverage)](https://codeclimate.com/github/apoex/nssql/test_coverage)
@@ -45,7 +46,7 @@ class TestTable < NSSQL::Table
45
46
  end
46
47
  ```
47
48
 
48
- ### Table
49
+ ### Select columns
49
50
 
50
51
  `TestTable.select_columns_query` will generate:
51
52
 
data/lib/nssql.rb CHANGED
@@ -35,11 +35,12 @@ module NSSQL
35
35
  private
36
36
 
37
37
  def execute(query)
38
- netsuite_connection.prepare(query).execute.tap do |result|
39
- yield result if block_given?
38
+ statement = netsuite_connection.prepare(query).execute
39
+ result = yield statement
40
40
 
41
- result.drop
42
- end
41
+ statement.drop
42
+
43
+ result
43
44
  end
44
45
 
45
46
  def system_call(command)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'singleton'
4
+
3
5
  module NSSQL
4
6
  # Simple class for configuration of credentials.
5
7
  class Settings
data/lib/nssql/table.rb CHANGED
@@ -10,24 +10,30 @@ module NSSQL
10
10
 
11
11
  <<~SQL
12
12
  SELECT
13
- #{@columns.join(',')}
13
+ #{columns.join(',')}
14
14
  FROM
15
- #{@table_name}
15
+ #{table_name}
16
16
  #{where_statement if where}
17
17
  ORDER BY
18
- #{@primary_keys.first}
18
+ #{primary_keys.first}
19
19
  SQL
20
20
  end
21
21
 
22
- def table_name(table_name)
22
+ def table_name(table_name = nil)
23
+ return @table_name if table_name.nil?
24
+
23
25
  @table_name = table_name
24
26
  end
25
27
 
26
28
  def primary_keys(*primary_keys)
29
+ return @primary_keys if primary_keys.empty?
30
+
27
31
  @primary_keys = primary_keys
28
32
  end
29
33
 
30
34
  def columns(*columns)
35
+ return @columns if columns.empty?
36
+
31
37
  @columns = columns
32
38
  end
33
39
  end
data/lib/nssql/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NSSQL
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nssql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Love Ottosson