spark_api 1.4.32 → 1.4.34

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
  SHA256:
3
- metadata.gz: 333a1c5cdb7419fa682dc3f46a04ef53c6cf97d42b78c7a28a268732b73d726d
4
- data.tar.gz: 36a17a5800f04b1452682bf29a841e4a488b35e42d5ea245f734da3c154ac0d0
3
+ metadata.gz: d372159752425b341adabf6fe1bf0361d28e4c1674f09f553b9e911f6294ac24
4
+ data.tar.gz: cad48a5f4871cb19982be6ba6fd01163957aaf4b552156066e7ed5ebe5581538
5
5
  SHA512:
6
- metadata.gz: 0b3d3d3d10e26d62acc9fa7e7b5edcc1acb3dc1a77be9e1f4ebff0e88f0a86f3cce9c0481480e1076e313d96e5c84ccc3bf456fb0ea5440c1761ca1427908e9a
7
- data.tar.gz: d4c92495fdf606b97c690ebc843705cab2a735939c3e8983a6d9a4e0974f9677fee24e12401430b1b1a832b8147d2d374b26635aa6535dc1958760dbfab3a426
6
+ metadata.gz: ea1807cfe81a706d50eb70a59a9e831720d69c46318a414dbf1e2c0bc0e75d31f289d6686a21644224efde694993bccff0d0659d0ac8bd873754c6ccf1802963
7
+ data.tar.gz: 8a6a226f3883d1f2bc9cb60bdaddf328e2e027f7d26452c0a60299ddd2ac99045cb19d8b1e55c00a35b15d418361d28f2aecadd750508ab68612f3c0e435fb73
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.32
1
+ 1.4.34
@@ -20,6 +20,7 @@ require 'spark_api/models/fields'
20
20
  require 'spark_api/models/idx'
21
21
  require 'spark_api/models/idx_link'
22
22
  require 'spark_api/models/incomplete_listing'
23
+ require 'spark_api/models/floplan'
23
24
  require 'spark_api/models/listing'
24
25
  require 'spark_api/models/listing_cart'
25
26
  require 'spark_api/models/listing_meta_translations'
@@ -0,0 +1,24 @@
1
+ module SparkApi
2
+ module Models
3
+ class FloPlan < Base
4
+ extend Subresource
5
+ self.element_name = 'floplans'
6
+
7
+ attr_accessor :images, :thumbnails
8
+
9
+ def initialize(attributes={})
10
+ @images = []
11
+ @thumbnails = []
12
+
13
+ attributes['Images'].each do |img|
14
+ if img["Type"].include?('thumbnail')
15
+ @thumbnails << img
16
+ else
17
+ @images << img
18
+ end
19
+ end
20
+ super(attributes)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,7 +2,7 @@ module SparkApi
2
2
  module Models
3
3
  class Listing < Base
4
4
  extend Finders
5
- attr_accessor :photos, :videos, :virtual_tours, :documents, :open_houses, :tour_of_homes, :rental_calendars
5
+ attr_accessor :photos, :videos, :virtual_tours, :documents, :open_houses, :tour_of_homes, :rental_calendars, :floplans
6
6
  attr_accessor :constraints
7
7
  self.element_name="listings"
8
8
  DATA_MASK = "********"
@@ -17,6 +17,7 @@ module SparkApi
17
17
  @constraints = []
18
18
  @tour_of_homes = []
19
19
  @open_houses = []
20
+ @floplans = []
20
21
 
21
22
  if attributes.has_key?('StandardFields')
22
23
  pics, vids, tours, docs, ohouses, tourhomes = attributes['StandardFields'].values_at('Photos','Videos', 'VirtualTours', 'Documents', 'OpenHouses', 'TourOfHomes')
@@ -26,6 +27,10 @@ module SparkApi
26
27
  rentalcalendars = attributes['RentalCalendar']
27
28
  end
28
29
 
30
+ if attributes.has_key?('FloPlans')
31
+ floplans = attributes['FloPlans']
32
+ end
33
+
29
34
  if pics != nil
30
35
  setup_attribute(@photos, pics, Photo)
31
36
  attributes['StandardFields'].delete('Photos')
@@ -61,6 +66,11 @@ module SparkApi
61
66
  attributes.delete('RentalCalendar')
62
67
  end
63
68
 
69
+ if floplans != nil
70
+ setup_attribute(@floplans, floplans, FloPlan)
71
+ attributes.delete('FloPlans')
72
+ end
73
+
64
74
  super(attributes)
65
75
  end
66
76
 
@@ -0,0 +1,15 @@
1
+ {
2
+ "D":{
3
+ "Results":[{
4
+ "Id": 4300,
5
+ "Name": "Feb 13",
6
+ "Images": [
7
+ {"Uri": "https://foo.bar",
8
+ "Type":"all_in_one_png"},
9
+ {"Uri": "https://foo.bar",
10
+ "Type": "all_in_one_thumbnail_png"}
11
+ ],
12
+ "Success":true
13
+ }]
14
+ }
15
+ }
@@ -0,0 +1,24 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe FloPlan do
4
+
5
+ it "responds to" do
6
+ FloPlan.should respond_to(:find_by_listing_key)
7
+ end
8
+
9
+ describe "/listings/<listing_id>/videos", :support do
10
+ before do
11
+ stub_auth_request
12
+ stub_api_get('/listings/1234/floplans','listings/floplans_index.json')
13
+ end
14
+
15
+ on_get_it "should correctly split images and thumbnails" do
16
+ p = FloPlan.find_by_listing_key('1234').first
17
+ p.attributes['Images'].length.should == 2
18
+ p.images.length.should == 1
19
+ p.thumbnails.length.should == 1
20
+ end
21
+
22
+ end
23
+
24
+ end
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.4.32
4
+ version: 1.4.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hornseth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-31 00:00:00.000000000 Z
12
+ date: 2020-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -335,6 +335,7 @@ files:
335
335
  - lib/spark_api/models/email_link.rb
336
336
  - lib/spark_api/models/fields.rb
337
337
  - lib/spark_api/models/finders.rb
338
+ - lib/spark_api/models/floplan.rb
338
339
  - lib/spark_api/models/idx.rb
339
340
  - lib/spark_api/models/idx_link.rb
340
341
  - lib/spark_api/models/incomplete_listing.rb
@@ -441,6 +442,7 @@ files:
441
442
  - spec/fixtures/listings/constraints.json
442
443
  - spec/fixtures/listings/constraints_with_pagination.json
443
444
  - spec/fixtures/listings/document_index.json
445
+ - spec/fixtures/listings/floplans_index.json
444
446
  - spec/fixtures/listings/multiple.json
445
447
  - spec/fixtures/listings/no_subresources.json
446
448
  - spec/fixtures/listings/open_houses.json
@@ -549,6 +551,7 @@ files:
549
551
  - spec/unit/spark_api/models/email_link_spec.rb
550
552
  - spec/unit/spark_api/models/fields_spec.rb
551
553
  - spec/unit/spark_api/models/finders_spec.rb
554
+ - spec/unit/spark_api/models/floplan_spec.rb
552
555
  - spec/unit/spark_api/models/listing_cart_spec.rb
553
556
  - spec/unit/spark_api/models/listing_meta_translations_spec.rb
554
557
  - spec/unit/spark_api/models/listing_spec.rb
@@ -664,6 +667,7 @@ test_files:
664
667
  - spec/fixtures/listings/constraints.json
665
668
  - spec/fixtures/listings/constraints_with_pagination.json
666
669
  - spec/fixtures/listings/document_index.json
670
+ - spec/fixtures/listings/floplans_index.json
667
671
  - spec/fixtures/listings/multiple.json
668
672
  - spec/fixtures/listings/no_subresources.json
669
673
  - spec/fixtures/listings/open_houses.json
@@ -771,6 +775,7 @@ test_files:
771
775
  - spec/unit/spark_api/models/email_link_spec.rb
772
776
  - spec/unit/spark_api/models/fields_spec.rb
773
777
  - spec/unit/spark_api/models/finders_spec.rb
778
+ - spec/unit/spark_api/models/floplan_spec.rb
774
779
  - spec/unit/spark_api/models/listing_cart_spec.rb
775
780
  - spec/unit/spark_api/models/listing_meta_translations_spec.rb
776
781
  - spec/unit/spark_api/models/listing_spec.rb