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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd6bba86a2ba09b2838876cd6f8d979f0733637b
4
- data.tar.gz: 9395c9de8e2aebecae9b0e70aeeae5adb408aa24
3
+ metadata.gz: 6136c5fd54ce8c3defd3fa0fbae6a8f2084ebbc5
4
+ data.tar.gz: ed279d5a24bdda5b71410e40df1e04f8ed209ca9
5
5
  SHA512:
6
- metadata.gz: d94a8868d52a52cda09b076963179f8de1b79b8634c825f1944abb9b67a74e0dc7bf0ffd1e69e1d3c5a279215295057fc881937b023a562b33c22ea1a4dad3db
7
- data.tar.gz: 2cdbc60e04c4ae047ef23469a1bae43198a06c9fca90ffadfa704c7deb193aab8b367c8619fdfbf6bfe71f5cf8447ea16369b8e7ab5959f9c6c5ec72a611a09d
6
+ metadata.gz: 4a4e64454749eb8f2a69022e1491fce1d3ea9ac0a0608e1cb04c675b379c103e3cacf7e6fa95ddc4f2ca37bc83c9d9962f37dfa93ffb484f284ea4a44dd6ee75
7
+ data.tar.gz: c4085e4a073aa080be3edb01831c681599b2851f5601c2360801dbb671481edc26fe99784657987c61f36eb0ae9f78dc8dc94492fd174cc6ce66a704dbe2935c
@@ -3,5 +3,6 @@ rvm:
3
3
  # could add more here- what's a good spread?
4
4
  - 2.0.0
5
5
  - 2.1.2
6
+ - 2.2.3
6
7
  install: bundle install
7
8
  script: rake test
@@ -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? && lid.nil?
25
+ elsif id.nil?
26
+ # vanilla object
20
27
  super(nil)
21
- elsif id.nil? && !lid.nil?
22
- super(nil)
23
- @list_id = lid
24
- elsif id.nil? || lid.nil?
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
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'riq'
5
- spec.version = '1.2.1'
5
+ spec.version = '1.2.2'
6
6
  spec.authors = ['David Brownman']
7
7
  spec.email = ['david@relateiq.com']
8
8
  spec.homepage = "https://github.com/relateiq/ruby-sdk"
@@ -56,9 +56,9 @@ describe RIQ::Contact do
56
56
  begin
57
57
  @c.add(:name, {value: 'Jenny'})
58
58
  rescue RIQ::RIQError
59
- nil.must_be_nil
59
+ assert(true)
60
60
  else
61
- 1.must_be_nil
61
+ assert(false)
62
62
  end
63
63
  end
64
64
  end
@@ -28,9 +28,9 @@ describe RIQ::Event do
28
28
  begin
29
29
  @e.save
30
30
  rescue RIQ::HTTPError
31
- nil.must_be_nil
31
+ assert(true)
32
32
  else
33
- 1.must_be_nil
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
- nil.must_be_nil
56
+ assert(true)
57
57
  else
58
- 1.must_be_nil
58
+ assert(false)
59
59
  end
60
60
  end
61
61
  end
@@ -7,6 +7,7 @@ unless ENV['RIQ_TEST_API_KEY'] && ENV['RIQ_TEST_API_SECRET']
7
7
  Dotenv.load
8
8
  end
9
9
 
10
+ # use directory, not locally installed copy
10
11
  require_relative '../lib/riq'
11
12
 
12
13
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -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.1
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-16 00:00:00.000000000 Z
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.5.1
154
+ rubygems_version: 2.4.8
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Ruby RIQ API client