riq 0.9.1 → 1.0.1
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
- metadata +4 -34
- data/.gitignore +0 -42
- data/.yardopts +0 -2
- data/Gemfile +0 -8
- data/LICENSE.txt +0 -21
- data/README.md +0 -15
- data/lib/riq.rb +0 -103
- data/lib/riq/account.rb +0 -82
- data/lib/riq/batch_manager.rb +0 -197
- data/lib/riq/client.rb +0 -148
- data/lib/riq/contact.rb +0 -158
- data/lib/riq/error.rb +0 -56
- data/lib/riq/event.rb +0 -165
- data/lib/riq/list.rb +0 -89
- data/lib/riq/list_item.rb +0 -119
- data/lib/riq/list_item_manager.rb +0 -13
- data/lib/riq/riq_obj.rb +0 -104
- data/lib/riq/user.rb +0 -47
- data/riq.gemspec +0 -29
- data/test/test.rb +0 -4
- data/test/test_account.rb +0 -44
- data/test/test_batch_manager.rb +0 -72
- data/test/test_contact.rb +0 -62
- data/test/test_event.rb +0 -56
- data/test/test_list_item.rb +0 -42
data/test/test_batch_manager.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require_relative '../lib/riq'
|
3
|
-
|
4
|
-
describe RIQ::BatchManager do
|
5
|
-
before do
|
6
|
-
RIQ.init
|
7
|
-
@c = 0
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#accounts' do
|
11
|
-
it 'should get all accounts' do
|
12
|
-
accounts = RIQ.accounts
|
13
|
-
accounts.each do |a|
|
14
|
-
a.id.wont_be_nil
|
15
|
-
a.name.wont_be_nil
|
16
|
-
@c += 1
|
17
|
-
break if @c >= 20
|
18
|
-
end
|
19
|
-
@c.wont_equal 0
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#contacts' do
|
24
|
-
it 'should get all contacts' do
|
25
|
-
contacts = RIQ.contacts
|
26
|
-
contacts.each do |con|
|
27
|
-
con.id.wont_be_nil
|
28
|
-
@c += 1
|
29
|
-
break if @c >= 20
|
30
|
-
end
|
31
|
-
@c.wont_equal 0
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#lists' do
|
36
|
-
it 'should get all lists' do
|
37
|
-
lists = RIQ.lists
|
38
|
-
lists.each do |l|
|
39
|
-
l.id.wont_be_nil
|
40
|
-
l.title.wont_be_nil
|
41
|
-
l.fields.wont_be_nil
|
42
|
-
@c += 1
|
43
|
-
lic = 0
|
44
|
-
l.list_items.each do |li|
|
45
|
-
lic += 1
|
46
|
-
break if lic >= 5
|
47
|
-
end
|
48
|
-
lic.wont_equal 0
|
49
|
-
break if @c >= 20
|
50
|
-
end
|
51
|
-
@c.wont_equal 0
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#first' do
|
56
|
-
it 'should get one contact' do
|
57
|
-
c = nil
|
58
|
-
c = RIQ.contacts.first
|
59
|
-
c.must_be_instance_of RIQ::Contact
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# describe '#fetch_options' do
|
64
|
-
# it 'should respect limits' do
|
65
|
-
# b = RIQ.contacts(opts: {_limit: 3})
|
66
|
-
# b.each do |i|
|
67
|
-
# @c += 1
|
68
|
-
# end
|
69
|
-
# @c.must_equal 3
|
70
|
-
# end
|
71
|
-
# end
|
72
|
-
end
|
data/test/test_contact.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require_relative '../lib/riq'
|
3
|
-
|
4
|
-
describe RIQ::Contact do
|
5
|
-
before do
|
6
|
-
RIQ.init
|
7
|
-
# sammy's contact ID
|
8
|
-
@sammy = RIQ.contact('542b205be4b04cd81270dff9')
|
9
|
-
@c = RIQ.contact
|
10
|
-
@dat = RIQ.contact({properties: {'name' => ['david'], email: ['dab@relateiq.com']}})
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#new' do
|
14
|
-
it 'should get account' do
|
15
|
-
@sammy.name.must_include 'Sammy Nammari'
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'make blank contact' do
|
19
|
-
@c.wont_be_nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#save' do
|
24
|
-
it 'should create new contact and delete it' do
|
25
|
-
@c.add(:name, 'Ron Mexico')
|
26
|
-
@c.save
|
27
|
-
|
28
|
-
@c.id.wont_be_nil
|
29
|
-
|
30
|
-
assert(@c.delete)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'properties' do
|
35
|
-
it 'should add new emails only if they\'re new' do
|
36
|
-
@sammy.email.must_equal @sammy.add(:email, 'nammari@stanford.edu')
|
37
|
-
|
38
|
-
@sammy.email.wont_equal @sammy.add(:email, 'jammari@stanford.edu')
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should only take strings as properties' do
|
42
|
-
@c.add(:phone, '867-5309').wont_be_empty
|
43
|
-
|
44
|
-
begin
|
45
|
-
@c.add(:name, {value: 'Jenny'})
|
46
|
-
rescue RIQ::RIQError
|
47
|
-
nil.must_be_nil
|
48
|
-
else
|
49
|
-
1.must_be_nil
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#upsert' do
|
55
|
-
it 'should upsert' do
|
56
|
-
# this could be better
|
57
|
-
@sammy.email.must_equal @sammy.upsert.email
|
58
|
-
|
59
|
-
# should add another assertion with the blank contact
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/test/test_event.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require_relative '../lib/riq'
|
3
|
-
|
4
|
-
describe RIQ::Event do
|
5
|
-
before do
|
6
|
-
RIQ.init
|
7
|
-
# sammy's contact ID
|
8
|
-
@e = RIQ.event
|
9
|
-
@ev = RIQ.event({subject: "My Sub", body: "Very intersting body", 'participantIds' => [{type: :email, value: 'fake@fakerelateiq.com'}]})
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#new' do
|
13
|
-
it 'should start blank' do
|
14
|
-
@e.subject.must_be_nil
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should take a hash' do
|
18
|
-
@ev.subject.wont_be_nil
|
19
|
-
@ev.participant_ids.wont_be_empty
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#save' do
|
24
|
-
it 'should fail without subject'do
|
25
|
-
begin
|
26
|
-
@e.save
|
27
|
-
rescue RIQ::HTTPError
|
28
|
-
nil.must_be_nil
|
29
|
-
else
|
30
|
-
1.must_be_nil
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should save with data' do
|
35
|
-
@ev.save.must_be_kind_of Hash
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#add_participant' do
|
40
|
-
it 'should add a participant' do
|
41
|
-
p = {type: :email, value: 'good'}
|
42
|
-
@e.add_participant(p[:type], p[:value])
|
43
|
-
@e.participant_ids.must_include p
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should reject bad types' do
|
47
|
-
begin
|
48
|
-
@e.add_participant(:blarg, 'bad type')
|
49
|
-
rescue RIQ::RIQError
|
50
|
-
nil.must_be_nil
|
51
|
-
else
|
52
|
-
1.must_be_nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
data/test/test_list_item.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require_relative '../lib/riq'
|
3
|
-
|
4
|
-
describe RIQ::ListItem do
|
5
|
-
before do
|
6
|
-
RIQ.init
|
7
|
-
lid = '54ca9b25e4b0b29d80ce4b4e'
|
8
|
-
@l = RIQ.list(lid)
|
9
|
-
@li = @l.list_items.first
|
10
|
-
@blank = @l.list_item
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#field_value' do
|
14
|
-
it 'should return a value' do
|
15
|
-
@li.field_value(0).wont_be_nil
|
16
|
-
@blank.field_value(0).must_be_nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#save' do
|
21
|
-
it 'should create and delete' do
|
22
|
-
@blank.field_value(0, 1)
|
23
|
-
@blank.contact_ids << RIQ.contacts.first.id
|
24
|
-
@blank.save
|
25
|
-
@blank.id.wont_be_nil
|
26
|
-
|
27
|
-
assert(@blank.delete)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should update' do
|
31
|
-
start = @li.field_value(0)
|
32
|
-
if start == '1'
|
33
|
-
@li.field_value(0, 0)
|
34
|
-
else
|
35
|
-
@li.field_value(0, 1)
|
36
|
-
end
|
37
|
-
@li.save
|
38
|
-
|
39
|
-
@li.field_value(0).wont_equal start
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|