salsalabs 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/salsa_labs/salsa_object.rb +4 -14
- data/lib/salsa_labs/version.rb +1 -1
- data/spec/fixtures/supporter/{supporter_create.xml → supporter_save.xml} +0 -0
- data/spec/integration/create_supporter_spec.rb +4 -4
- data/spec/unit/salsa_labs/objects/supporter_spec.rb +4 -13
- metadata +3 -5
- data/spec/fixtures/supporter/supporter_update.xml +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzI5OTNlODA4YWNmOGI0ZGU2YTAyMjkyNzg0YzYxZjkwMjQ5NTkyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmY2NWRlNjZhM2NlM2I4YzVjOTFiNWRhZDcxZDU4ZGQ0MzI2MWExYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTBjNjdjZDA4YmExNWZiMzQzOTM0OTZlZTBmYzJhYjU3MGIzNGIyMDg4MTI0
|
10
|
+
MGYwZmEzMTFiNmU2ODMyNjM4ODY5MzZiOTc4YjM4NDI5Y2E5YWI5YWY4YjZl
|
11
|
+
Zjg5YzQzZmJhZGIxNTU1MzU3YThhMmIzYzliOTZlOWJkYTNlYjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzRmMTdhZDgxNmYwNTVmYTA5NmI0NzJlYjIyM2JjNWNmMjY0MDNhMDYzZGY4
|
14
|
+
OTUxYTQ5MjhiOGE5NDZhMTBmOGFiYWViZmQwNzEwNDM0OGNhYThlM2QxZjZl
|
15
|
+
OWU1NjU1YTVkZTBhZWJkZGJkNGNiNTYxOTkyMWIxNTdkOGJjMTY=
|
@@ -37,26 +37,16 @@ module SalsaLabs
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
# @return [String] the
|
40
|
+
# @return [String] the created or modified object's key
|
41
41
|
# @raise [APIResponseError]
|
42
|
-
# if the request to
|
43
|
-
def
|
44
|
-
attributes.merge!({ object: object_name
|
42
|
+
# if the request to save the object failed
|
43
|
+
def save(attributes)
|
44
|
+
attributes.merge!({ object: object_name })
|
45
45
|
SalsaLabs.request('save', attributes) do |response|
|
46
46
|
SalsaLabs::SaveResponse.new(response).key
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
# @return [Boolean] true if request was successful
|
51
|
-
# @raise [APIResponseError]
|
52
|
-
# if the request to update the object failed
|
53
|
-
def update(key, attributes)
|
54
|
-
attributes.merge!({ object: object_name, key: key.to_s })
|
55
|
-
SalsaLabs.request('save', attributes) do |response|
|
56
|
-
SalsaLabs::SaveResponse.new(response).successful?
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
50
|
private
|
61
51
|
|
62
52
|
# @return [String] the name of this class in lowercase and underscored format
|
data/lib/salsa_labs/version.rb
CHANGED
File without changes
|
@@ -2,15 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'POST Supporter', type: :integration do
|
4
4
|
subject do
|
5
|
-
SalsaLabs::Supporter.
|
5
|
+
SalsaLabs::Supporter.save(
|
6
6
|
:First_Name => 'IntegrationSpec',
|
7
7
|
:Last_Name => Time.now.to_i.to_s
|
8
8
|
)
|
9
9
|
end
|
10
10
|
|
11
|
-
it '
|
11
|
+
it 'saves the supporter' do
|
12
12
|
expect(subject).to be_a(String)
|
13
|
-
|
14
|
-
expect(subject).to eq(
|
13
|
+
saved_object = SalsaLabs::Supporter.get(subject)
|
14
|
+
expect(subject).to eq(saved_object['key'])
|
15
15
|
end
|
16
16
|
end
|
@@ -41,22 +41,13 @@ describe SalsaLabs::Supporter do
|
|
41
41
|
specify { expect(SalsaLabs::Supporter.count).to eq(expected) }
|
42
42
|
end
|
43
43
|
|
44
|
-
describe '#
|
44
|
+
describe '#save' do
|
45
45
|
let(:path){ 'save' }
|
46
|
-
let(:params){ { :object => 'supporter', :
|
47
|
-
let(:response){ fixture_file 'supporter/
|
46
|
+
let(:params){ { :object => 'supporter', :Phone => '4159876543' } }
|
47
|
+
let(:response){ fixture_file 'supporter/supporter_save.xml' }
|
48
48
|
let(:expected){ '12345678' }
|
49
49
|
|
50
|
-
specify { expect(SalsaLabs::Supporter.
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#update' do
|
54
|
-
let(:path){ 'save' }
|
55
|
-
let(:params){ { :object => 'supporter', :key => '12345678', :Phone => '4159876543' } }
|
56
|
-
let(:response){ fixture_file 'supporter/supporter_update.xml' }
|
57
|
-
let(:expected){ true }
|
58
|
-
|
59
|
-
specify { expect(SalsaLabs::Supporter.update('12345678', :Phone => '4159876543')).to eq(expected) }
|
50
|
+
specify { expect(SalsaLabs::Supporter.save(:Phone => '4159876543')).to eq(expected) }
|
60
51
|
end
|
61
52
|
end
|
62
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salsalabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Love
|
@@ -192,9 +192,8 @@ files:
|
|
192
192
|
- spec/fixtures/malformed_response.txt
|
193
193
|
- spec/fixtures/supporter/supporter_all.xml
|
194
194
|
- spec/fixtures/supporter/supporter_count.xml
|
195
|
-
- spec/fixtures/supporter/supporter_create.xml
|
196
195
|
- spec/fixtures/supporter/supporter_get.xml
|
197
|
-
- spec/fixtures/supporter/
|
196
|
+
- spec/fixtures/supporter/supporter_save.xml
|
198
197
|
- spec/fixtures/supporters.txt
|
199
198
|
- spec/integration/create_supporter_spec.rb
|
200
199
|
- spec/integration/get_supporter_spec.rb
|
@@ -239,9 +238,8 @@ test_files:
|
|
239
238
|
- spec/fixtures/malformed_response.txt
|
240
239
|
- spec/fixtures/supporter/supporter_all.xml
|
241
240
|
- spec/fixtures/supporter/supporter_count.xml
|
242
|
-
- spec/fixtures/supporter/supporter_create.xml
|
243
241
|
- spec/fixtures/supporter/supporter_get.xml
|
244
|
-
- spec/fixtures/supporter/
|
242
|
+
- spec/fixtures/supporter/supporter_save.xml
|
245
243
|
- spec/fixtures/supporters.txt
|
246
244
|
- spec/integration/create_supporter_spec.rb
|
247
245
|
- spec/integration/get_supporter_spec.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
<success object="supporter" key="12345678">Modified entry 12345678</success>
|