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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWU5OGQ4NmJjNjQxYjhiY2QwNjhkNzIzZDhjNDE1ZThlYWFmNzZlNA==
4
+ YzI5OTNlODA4YWNmOGI0ZGU2YTAyMjkyNzg0YzYxZjkwMjQ5NTkyNw==
5
5
  data.tar.gz: !binary |-
6
- MTAyNDllZGEwNTdkOTUwYjZlNDcwNjA2MmFkM2JkZjk1M2Q5MGJhMg==
6
+ MmY2NWRlNjZhM2NlM2I4YzVjOTFiNWRhZDcxZDU4ZGQ0MzI2MWExYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODg4MjMxOWM0YWUzYjQ5ZGU2ZjgyMjFhNjFlZDZkZDAwY2MwN2Y2NjI0ZTNl
10
- OTNkMDQ4N2NhNmFiNTBmYmRkZjE5NDIwMTQ0N2M2Y2NmNDY4ZWNhOTBlZmI3
11
- YWEzOWMxODM5Y2IxYTEzNjZhZmM0Y2I3N2QyNWM4NjNlM2UxYzk=
9
+ YTBjNjdjZDA4YmExNWZiMzQzOTM0OTZlZTBmYzJhYjU3MGIzNGIyMDg4MTI0
10
+ MGYwZmEzMTFiNmU2ODMyNjM4ODY5MzZiOTc4YjM4NDI5Y2E5YWI5YWY4YjZl
11
+ Zjg5YzQzZmJhZGIxNTU1MzU3YThhMmIzYzliOTZlOWJkYTNlYjg=
12
12
  data.tar.gz: !binary |-
13
- MzNlYmYxNDUxNDc2OGZjM2U4ZTViYzBmMzEzNDJkNjA3ZTJlOTRhNzdiMmMx
14
- ZTljMzVlNGViN2ZhY2RmNzI2ODJhYTc4NzdmZTRkM2E3YzA3MTM1MzEwMDVi
15
- NDQxZmRlNjUwZDlkOTUyZmVhMTkxNGFkMmI1MDY0MzFiMWM3YzQ=
13
+ YzRmMTdhZDgxNmYwNTVmYTA5NmI0NzJlYjIyM2JjNWNmMjY0MDNhMDYzZGY4
14
+ OTUxYTQ5MjhiOGE5NDZhMTBmOGFiYWViZmQwNzEwNDM0OGNhYThlM2QxZjZl
15
+ OWU1NjU1YTVkZTBhZWJkZGJkNGNiNTYxOTkyMWIxNTdkOGJjMTY=
@@ -37,26 +37,16 @@ module SalsaLabs
37
37
  end
38
38
  end
39
39
 
40
- # @return [String] the newly created object's key
40
+ # @return [String] the created or modified object's key
41
41
  # @raise [APIResponseError]
42
- # if the request to create the object failed
43
- def create(attributes)
44
- attributes.merge!({ object: object_name, key: '0' })
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
@@ -1,3 +1,3 @@
1
1
  module SalsaLabs
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -2,15 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe 'POST Supporter', type: :integration do
4
4
  subject do
5
- SalsaLabs::Supporter.create(
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 'creates the supporter' do
11
+ it 'saves the supporter' do
12
12
  expect(subject).to be_a(String)
13
- created_object = SalsaLabs::Supporter.get(subject)
14
- expect(subject).to eq(created_object['key'])
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 '#create' do
44
+ describe '#save' do
45
45
  let(:path){ 'save' }
46
- let(:params){ { :object => 'supporter', :key => '0', :Phone => '4159876543' } }
47
- let(:response){ fixture_file 'supporter/supporter_create.xml' }
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.create(:Phone => '4159876543')).to eq(expected) }
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.1.1
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/supporter_update.xml
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/supporter_update.xml
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>