klink-ruby-api 1.0.6

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.
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class KineticLink_EntryTest < Test::Unit::TestCase
4
+
5
+ def test_entry
6
+ entry = nil
7
+ existing_entry = Kinetic::Link::entries('User')[0]
8
+ assert_nothing_thrown {
9
+ entry = Kinetic::Link::entry('User', existing_entry)
10
+ }
11
+ assert_not_nil(entry)
12
+ assert_match(/^\d+$/,entry['1'])
13
+ assert_instance_of(Hash,entry)
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,55 @@
1
+ require File.dirname(__FILE__) +'/../test_helper'
2
+
3
+
4
+ class StatisticsTest < Test::Unit::TestCase
5
+ def test_get_statistic
6
+
7
+ stat_name = "API_REQUESTS"
8
+
9
+ assert_nothing_thrown {
10
+ stat = Kinetic::Link.statistics(stat_name)
11
+
12
+ assert_not_nil stat
13
+ assert_kind_of Hash,stat
14
+ assert_not_nil stat[stat_name]
15
+ assert_kind_of String, stat[stat_name]
16
+ assert_kind_of Integer, stat[stat_name].to_i
17
+ assert (stat[stat_name].to_i > 0)
18
+
19
+ }
20
+
21
+
22
+ end
23
+
24
+ def test_get_multi_statistic
25
+
26
+ stat_name = "API_REQUESTS,CURRENT_USERS"
27
+ stat_one = "API_REQUESTS"
28
+
29
+
30
+ assert_nothing_thrown {
31
+ stat = Kinetic::Link.statistics(stat_name)
32
+
33
+ assert_not_nil stat
34
+ assert_kind_of Hash,stat
35
+ assert (stat.keys.size == 2)
36
+ assert_not_nil stat[stat_one]
37
+ assert_kind_of String, stat[stat_one]
38
+ assert_kind_of Integer, stat[stat_one].to_i
39
+ assert (stat[stat_one].to_i > 0)
40
+
41
+ }
42
+
43
+
44
+ end
45
+
46
+
47
+
48
+ end
49
+
50
+
51
+
52
+
53
+
54
+
55
+
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) +'/../test_helper'
2
+
3
+ class StructureTest < Test::Unit::TestCase
4
+
5
+
6
+ def test_get_structure
7
+
8
+ struc_name = "User"
9
+
10
+ assert_nothing_thrown {
11
+ struc_info = Kinetic::Link.structure(struc_name)
12
+
13
+ assert_not_nil struc_info
14
+ assert_kind_of Hash,struc_info
15
+
16
+ }
17
+
18
+
19
+ end
20
+
21
+
22
+
23
+ end
24
+
25
+
26
+
27
+
28
+
29
+
30
+
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) +'/../test_helper'
2
+
3
+
4
+ class StructuresTest < Test::Unit::TestCase
5
+ def test_get_structures
6
+
7
+ struct_list = Array.new
8
+
9
+ assert_nothing_thrown {
10
+ struct_list = Kinetic::Link.structures
11
+
12
+ assert_not_nil struct_list
13
+ assert_kind_of Array,struct_list
14
+
15
+ }
16
+
17
+
18
+ end
19
+
20
+
21
+
22
+ end
23
+
24
+
25
+
26
+
27
+
28
+
29
+
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) +'/../test_helper'
2
+
3
+ class KineticLink_UpdateTest < Test::Unit::TestCase
4
+
5
+ def test_update_simple
6
+ fields = {'2' => "Klink", '4' => "Shayne", '8' => "Test entry - No time"}
7
+ record = Kinetic::Link.create("KLINK_CanonicalForm", fields)
8
+ updated_fields = {'8' => "Test entry - #{Time.now}"}
9
+ success = nil
10
+ assert_nothing_thrown {
11
+ success = Kinetic::Link.update("KLINK_CanonicalForm", record, updated_fields)
12
+ }
13
+
14
+ assert_equal(true,success)
15
+ end
16
+
17
+ def test_update_record_does_not_exist
18
+ fields = {'8' => "Test entry - #{Time.now}"}
19
+ success = nil
20
+ assert_throws (:runtime_error) {
21
+ success = Kinetic::Link.update("KLINK_CanonicalForm", "DOES NOT EXIST", fields)
22
+ }
23
+ rescue RuntimeError
24
+
25
+ end
26
+
27
+
28
+ # Test that we throw an error when we attempt to update a locked field
29
+ def test_update_locked_field
30
+ fields = {'2' => "Klink", '4' => "Shayne", '8' => "Test entry - #{Time.now}"}
31
+ record = Kinetic::Link.create("KLINK_CanonicalForm", fields)
32
+ updated_fields = {'2' => "Test"}
33
+ updated_record = nil
34
+ assert_throws (:runtime_error) {
35
+ updated_record = Kinetic::Link.update("KLINK_CanonicalForm", record, updated_fields)
36
+ }
37
+ rescue RuntimeError
38
+ assert_nil(updated_record)
39
+ end
40
+ end
41
+
@@ -0,0 +1,6 @@
1
+ require 'test/unit'
2
+ require 'lib/kinetic/link'
3
+
4
+
5
+ # tells klink.yml what to load for environment
6
+ $klink_env = "test"
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: klink-ruby-api
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 6
10
+ version: 1.0.6
11
+ platform: ruby
12
+ authors:
13
+ - John Sundberg
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-31 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: john.sundberg@kineticdata.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README
30
+ - CHANGELOG
31
+ files:
32
+ - README
33
+ - Rakefile
34
+ - config/klink.example.yml
35
+ - config/klink_test_suite.def
36
+ - lib/kinetic/link.rb
37
+ - lib/klink-ruby-api.rb
38
+ - test/functional/configurations_test.rb
39
+ - test/functional/create_test.rb
40
+ - test/functional/delete_test.rb
41
+ - test/functional/entries_test.rb
42
+ - test/functional/entry_test.rb
43
+ - test/functional/statistics_test.rb
44
+ - test/functional/structures_test.rb
45
+ - test/functional/structure_test.rb
46
+ - test/functional/update_test.rb
47
+ - test/test_helper.rb
48
+ - CHANGELOG
49
+ has_rdoc: true
50
+ homepage: http://www.kineticdata.com
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --line-numbers
56
+ - --inline-source
57
+ - --title
58
+ - Kinetic Link Ruby API
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project: N/A
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Ruby wrapper library for Kinetic Link.
86
+ test_files: []
87
+