spark_api 1.3.14 → 1.3.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc36316e46c3d4eed71335e4cb11a78df3cdc95
4
- data.tar.gz: c3a77a5ff07892b4fa5fa05ea9c7ed4c5bda3587
3
+ metadata.gz: 687db510d1db3dbc720b8eb4e7ad2a68127c6617
4
+ data.tar.gz: 9b7bf97650e363dd73499e26d87061857a7fa5ba
5
5
  SHA512:
6
- metadata.gz: 664963b48215cc6f186a6410a88d3128a7e22c2b8add74aebb00c9a614494511c732102a6886bd277697e361e55ab567e25c20d4f945e79d890033df4bdc284a
7
- data.tar.gz: 60690df54e311cc30a262c448adb324c09d33fbbdb1a8b091905551c746b11b58858be24cf1d41e4e511fb594b778a464378658f4ec40997cf4916519a44d653
6
+ metadata.gz: 657660ae43a218bcad21afae2fb6e214555f073a8cf18b9ebb4b4582b585fc082e78de40ddcd659a324721b496c70e0ee7cfbf056058d4db52ef38fe9898c4b1
7
+ data.tar.gz: 506ab6e63930569d69e43d6bd5fcd3a7684bb370c784ed6ecbaddf739f3f9197fe0669d32f77376e46a1ced0ce80e483ccf4d7237a0f15a5806573864734d978
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.14
1
+ 1.3.15
@@ -18,7 +18,7 @@ module SparkApi
18
18
  def self.my(arguments={})
19
19
  new(connection.get('/my/contact', arguments).first)
20
20
  end
21
-
21
+
22
22
  def self.export(arguments={})
23
23
  collect(connection.get("/contacts/export", arguments))
24
24
  end
@@ -65,7 +65,7 @@ module SparkApi
65
65
  nil
66
66
  end
67
67
  end
68
-
68
+
69
69
  end
70
70
  end
71
71
  end
@@ -1,12 +1,17 @@
1
1
  module SparkApi
2
2
  module Models
3
- class ListingCart < Base
3
+ class ListingCart < Base
4
4
  extend Finders
5
5
  include Concerns::Savable,
6
6
  Concerns::Destroyable
7
7
 
8
8
  self.element_name="listingcarts"
9
9
 
10
+ def initialize(attributes={})
11
+ @contact_id = attributes.delete(:contact_id) if attributes[:contact_id]
12
+ super(attributes)
13
+ end
14
+
10
15
  def ListingIds=(listing_ids)
11
16
  attributes["ListingIds"] = Array(listing_ids)
12
17
  end
@@ -14,9 +19,17 @@ module SparkApi
14
19
  attributes["Name"] = name
15
20
  end
16
21
 
22
+ def path
23
+ if @contact_id
24
+ "/contacts/#{@contact_id}/listingcarts"
25
+ else
26
+ super
27
+ end
28
+ end
29
+
17
30
  def add_listing(listing)
18
- id = listing.respond_to?(:Id) ? listing.Id : listing.to_s
19
- results = connection.post("#{self.class.path}/#{self.Id}", {"ListingIds" => [ listing ]})
31
+ ids = listing.respond_to?(:Id) ? listing.Id : listing
32
+ results = connection.post("#{self.resource_uri}", {"ListingIds" => Array(ids)})
20
33
  self.ListingCount = results.first["ListingCount"]
21
34
  end
22
35
 
@@ -0,0 +1,13 @@
1
+ {
2
+ "D": {
3
+ "Success": true,
4
+ "Results": [
5
+ {
6
+ "ResourceUri": "/v1/contact/20090928182824338901000000/listingcarts/20100912153422758914000000",
7
+ "Id": "20100912153422758914000000",
8
+ "Name": "My Listing Cart",
9
+ "ListingCount": 11
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "D": {
3
+ "ListingIds": [ "20110621133454434543000000" ]
4
+ }
5
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "D": {
3
+ "Success": true,
4
+ "Results": [
5
+ {
6
+ "ResourceUri": "/v1/contacts/20090928182824338901000000/listingcarts/20100912153422758914000000",
7
+ "Id": "20100912153422758914000000",
8
+ "Name": "My Listing Cart",
9
+ "ListingCount": 10
10
+ },
11
+ {
12
+ "ResourceUri": "/v1/contacts/20090928182824338901000000/listingcarts/20110112133422752751000000",
13
+ "Id": "20110112133422752751000000",
14
+ "Name": "My Other Listing Cart",
15
+ "ListingCount": 15
16
+ }
17
+ ]
18
+ }
19
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "D": {
3
+ "ListingCarts": [{
4
+ "Name": "Non-existent Portal Cart",
5
+ "ListingIds": [
6
+ "20110112234857732941000000"
7
+ ]
8
+ }]
9
+ }
10
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "D": {
3
- "Success": true,
3
+ "Success": true,
4
4
  "Results": [
5
5
  {
6
6
  "ResourceUri":"/v1/listingcarts/20100912153422758914000000"
@@ -0,0 +1,10 @@
1
+ {
2
+ "D": {
3
+ "Success": true,
4
+ "Results": [
5
+ {
6
+ "ResourceUri":"/v1/contacts/20090928182824338901000000/listingcarts/20100912153422758914000000"
7
+ }
8
+ ]
9
+ }
10
+ }
@@ -172,16 +172,15 @@ describe Contact do
172
172
 
173
173
  on_get_it "should get all the listing carts belonging to the customer" do
174
174
  stub_api_get("/contacts/#{contact.Id}/listingcarts", 'listing_carts/listing_cart.json')
175
- saved_searches = contact.listing_carts
176
- saved_searches.should be_an(Array)
177
- saved_searches.length.should eq(2)
175
+ listing_carts = contact.listing_carts
176
+ listing_carts.should be_an(Array)
177
+ listing_carts.length.should eq(2)
178
178
  end
179
179
 
180
180
  it "should pass any arguments as parameters" do
181
181
  stub_api_get("/contacts/#{contact.Id}/listingcarts", 'listing_carts/listing_cart.json', :test_argument => "yay")
182
- saved_searches = contact.listing_carts(:test_argument => "yay")
182
+ contact.listing_carts(:test_argument => "yay")
183
183
  end
184
-
185
184
  end
186
185
 
187
186
  context "/portal", :support do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spark_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.14
4
+ version: 1.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hornseth
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2014-06-19 00:00:00 Z
13
+ date: 2014-07-03 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -292,10 +292,15 @@ files:
292
292
  - spec/fixtures/idx_links/get.json
293
293
  - spec/fixtures/listing_carts/add_listing.json
294
294
  - spec/fixtures/listing_carts/add_listing_post.json
295
+ - spec/fixtures/listing_carts/add_portal_cart_listings.json
296
+ - spec/fixtures/listing_carts/add_portal_cart_listings_post.json
295
297
  - spec/fixtures/listing_carts/empty.json
296
298
  - spec/fixtures/listing_carts/listing_cart.json
299
+ - spec/fixtures/listing_carts/listing_portal_cart.json
297
300
  - spec/fixtures/listing_carts/new.json
301
+ - spec/fixtures/listing_carts/new_portal_cart.json
298
302
  - spec/fixtures/listing_carts/post.json
303
+ - spec/fixtures/listing_carts/post_portal_cart.json
299
304
  - spec/fixtures/listing_carts/remove_listing.json
300
305
  - spec/fixtures/listings/constraints.json
301
306
  - spec/fixtures/listings/constraints_with_pagination.json
@@ -537,9 +542,14 @@ test_files:
537
542
  - spec/fixtures/logo_fbs.png
538
543
  - spec/fixtures/listing_carts/listing_cart.json
539
544
  - spec/fixtures/listing_carts/add_listing.json
545
+ - spec/fixtures/listing_carts/add_portal_cart_listings_post.json
540
546
  - spec/fixtures/listing_carts/add_listing_post.json
547
+ - spec/fixtures/listing_carts/post_portal_cart.json
548
+ - spec/fixtures/listing_carts/add_portal_cart_listings.json
541
549
  - spec/fixtures/listing_carts/remove_listing.json
550
+ - spec/fixtures/listing_carts/listing_portal_cart.json
542
551
  - spec/fixtures/listing_carts/empty.json
552
+ - spec/fixtures/listing_carts/new_portal_cart.json
543
553
  - spec/fixtures/listing_carts/post.json
544
554
  - spec/fixtures/listing_carts/new.json
545
555
  - spec/fixtures/empty.json