riq 1.2.1 → 1.2.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/riq/list_item.rb +19 -5
- data/lib/riq/riq_obj.rb +5 -0
- data/riq.gemspec +1 -1
- data/test/test_contact.rb +2 -2
- data/test/test_event.rb +4 -4
- data/test/test_helper.rb +1 -0
- data/test/test_list_item.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6136c5fd54ce8c3defd3fa0fbae6a8f2084ebbc5
|
4
|
+
data.tar.gz: ed279d5a24bdda5b71410e40df1e04f8ed209ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4e64454749eb8f2a69022e1491fce1d3ea9ac0a0608e1cb04c675b379c103e3cacf7e6fa95ddc4f2ca37bc83c9d9962f37dfa93ffb484f284ea4a44dd6ee75
|
7
|
+
data.tar.gz: c4085e4a073aa080be3edb01831c681599b2851f5601c2360801dbb671481edc26fe99784657987c61f36eb0ae9f78dc8dc94492fd174cc6ce66a704dbe2935c
|
data/.travis.yml
CHANGED
data/lib/riq/list_item.rb
CHANGED
@@ -13,17 +13,25 @@ module RIQ
|
|
13
13
|
attr_reader :modified_date
|
14
14
|
attr_reader :created_date
|
15
15
|
|
16
|
+
# @example create a list item
|
17
|
+
# # vanilla
|
18
|
+
# RIQ::ListItem.new
|
19
|
+
# # with a list id
|
20
|
+
# RIQ::ListItem(lid: 'abc123') # OR RIQ.list('abc123').list_item
|
16
21
|
def initialize(id = nil, lid: nil)
|
17
22
|
if id.is_a? Hash
|
23
|
+
# init with data
|
18
24
|
super(id)
|
19
|
-
elsif id.nil?
|
25
|
+
elsif id.nil?
|
26
|
+
# vanilla object
|
20
27
|
super(nil)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
28
|
+
# maybe init with lid
|
29
|
+
@list_id = lid unless lid.nil?
|
30
|
+
elsif lid.nil?
|
31
|
+
# has id, but not lid, that's an error
|
25
32
|
raise RIQError, 'ObjectID and List ID are required'
|
26
33
|
else
|
34
|
+
# grabbing a specific listitem, fetch it
|
27
35
|
super("#{lid}/listitems/#{id}")
|
28
36
|
end
|
29
37
|
end
|
@@ -115,5 +123,11 @@ module RIQ
|
|
115
123
|
end
|
116
124
|
self
|
117
125
|
end
|
126
|
+
|
127
|
+
def pre_save
|
128
|
+
if @list_id.nil?
|
129
|
+
raise RIQError, 'List ID is required'
|
130
|
+
end
|
131
|
+
end
|
118
132
|
end
|
119
133
|
end
|
data/lib/riq/riq_obj.rb
CHANGED
@@ -60,6 +60,7 @@ module RIQ
|
|
60
60
|
|
61
61
|
# Creates or updates the object
|
62
62
|
def save(options = nil)
|
63
|
+
pre_save
|
63
64
|
if @id.nil?
|
64
65
|
# create
|
65
66
|
init(@client.post(node, payload, options: options).symbolize)
|
@@ -92,6 +93,10 @@ module RIQ
|
|
92
93
|
raise RIQError, 'This should be overwritten'
|
93
94
|
end
|
94
95
|
|
96
|
+
def pre_save
|
97
|
+
# do any validation necessary
|
98
|
+
end
|
99
|
+
|
95
100
|
# def exists
|
96
101
|
# if @id.nil?
|
97
102
|
# false
|
data/riq.gemspec
CHANGED
data/test/test_contact.rb
CHANGED
data/test/test_event.rb
CHANGED
@@ -28,9 +28,9 @@ describe RIQ::Event do
|
|
28
28
|
begin
|
29
29
|
@e.save
|
30
30
|
rescue RIQ::HTTPError
|
31
|
-
|
31
|
+
assert(true)
|
32
32
|
else
|
33
|
-
|
33
|
+
assert(false)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -53,9 +53,9 @@ describe RIQ::Event do
|
|
53
53
|
begin
|
54
54
|
@e.add_participant(:blarg, 'bad type')
|
55
55
|
rescue RIQ::RIQError
|
56
|
-
|
56
|
+
assert(true)
|
57
57
|
else
|
58
|
-
|
58
|
+
assert(false)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/test/test_helper.rb
CHANGED
data/test/test_list_item.rb
CHANGED
@@ -47,5 +47,16 @@ describe RIQ::ListItem do
|
|
47
47
|
|
48
48
|
@li.field_value(0).wont_equal start
|
49
49
|
end
|
50
|
+
|
51
|
+
it 'should fail without a list id' do
|
52
|
+
@li = RIQ::ListItem.new
|
53
|
+
begin
|
54
|
+
@li.save
|
55
|
+
rescue RIQ::RIQError
|
56
|
+
assert(true)
|
57
|
+
else
|
58
|
+
assert(false)
|
59
|
+
end
|
60
|
+
end
|
50
61
|
end
|
51
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Brownman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.4.
|
154
|
+
rubygems_version: 2.4.8
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Ruby RIQ API client
|