g5_foundation_client 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/g5_foundation_client.gemspec +1 -2
- data/lib/g5_foundation_client.rb +4 -9
- data/lib/g5_foundation_client/fetcher.rb +14 -12
- data/lib/g5_foundation_client/models/client.rb +11 -10
- data/lib/g5_foundation_client/models/findable_by_uid.rb +2 -2
- data/lib/g5_foundation_client/models/integration_setting.rb +22 -19
- data/lib/g5_foundation_client/models/location.rb +57 -22
- data/lib/g5_foundation_client/version.rb +1 -1
- data/spec/fixtures/hub-client.json +1 -0
- data/spec/fixtures/hub-location.json +1 -0
- data/spec/lib/g5_foundation_client/models/client_spec.rb +5 -5
- data/spec/lib/g5_foundation_client/models/integration_setting_spec.rb +39 -38
- data/spec/lib/g5_foundation_client/models/location_spec.rb +29 -25
- metadata +7 -33
- data/lib/g5_foundation_client/deserializers/client.rb +0 -25
- data/lib/g5_foundation_client/deserializers/integration_setting.rb +0 -42
- data/lib/g5_foundation_client/deserializers/location.rb +0 -37
- data/lib/g5_foundation_client/deserializers/safe_access.rb +0 -12
- data/spec/fixtures/client_detail.html +0 -220
- data/spec/fixtures/empty_hcard.html +0 -8
- data/spec/fixtures/location_detail.html +0 -154
- data/spec/lib/g5_foundation_client/deserializers/client_spec.rb +0 -31
- data/spec/lib/g5_foundation_client/deserializers/integration_setting_spec.rb +0 -23
- data/spec/lib/g5_foundation_client/deserializers/location_spec.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5b38c956c0df7d76098a167757cfb0ad5b156a
|
4
|
+
data.tar.gz: 1b13637bfaba09aa70df1733c89d8dc662333144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fda59208298cc93d577b5014ab871f60cefef040e240c026a7bba3cc2360eacc983db8be30361429fa4a1b6160e3b919e7a053fe7fd15cda8efcf375971b277f
|
7
|
+
data.tar.gz: 41a77f8a3730a2835eb491e67527160cb73e41d1db1a7eab5a9604baa127a5146f42aa17e1fe8ccdf5fae40135b9e3659ca8ca5bfc8e9a73a992ccbc9b10f2c0
|
@@ -18,9 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "
|
21
|
+
spec.add_dependency "activesupport"
|
22
22
|
spec.add_dependency "httparty"
|
23
|
-
spec.add_dependency "microformats2"
|
24
23
|
spec.add_dependency "g5_authentication_client", ">= 0.2"
|
25
24
|
|
26
25
|
spec.add_development_dependency "bundler", "~> 1.5"
|
data/lib/g5_foundation_client.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require "g5_foundation_client/version"
|
1
|
+
require 'active_support/core_ext/hash'
|
2
|
+
require 'httparty'
|
3
|
+
require 'g5_authentication_client'
|
4
|
+
require 'g5_foundation_client/version'
|
6
5
|
|
7
6
|
module G5FoundationClient
|
8
7
|
def self.access_token=(token)
|
@@ -24,8 +23,4 @@ require 'g5_foundation_client/models/integration_setting'
|
|
24
23
|
require 'g5_foundation_client/models/location'
|
25
24
|
require 'g5_foundation_client/models/client'
|
26
25
|
|
27
|
-
require 'g5_foundation_client/deserializers/safe_access'
|
28
|
-
require 'g5_foundation_client/deserializers/integration_setting'
|
29
|
-
require 'g5_foundation_client/deserializers/location'
|
30
|
-
require 'g5_foundation_client/deserializers/client'
|
31
26
|
|
@@ -1,21 +1,23 @@
|
|
1
1
|
class G5FoundationClient::Fetcher
|
2
2
|
def self.fetch_url(url, &block)
|
3
3
|
response = HTTParty.get(
|
4
|
-
|
5
|
-
|
4
|
+
url,
|
5
|
+
{query: {access_token: G5FoundationClient::access_token},
|
6
|
+
headers: {'Content-Type' => 'application/json', 'Accept' => 'application/json'}
|
7
|
+
}
|
6
8
|
)
|
7
9
|
|
8
10
|
case response.response.code.to_i
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
when 200
|
12
|
+
yield response.body
|
13
|
+
when 404
|
14
|
+
raise G5FoundationClient::RecordNotFoundException.new(
|
15
|
+
"Couldn't find record at URL '#{url}'"
|
16
|
+
)
|
17
|
+
else
|
18
|
+
raise Exception.new(
|
19
|
+
"I got an unexpected response code '#{response.response.code}'"
|
20
|
+
)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
class G5FoundationClient::Client
|
2
|
-
include Virtus.model
|
3
2
|
extend G5FoundationClient::FindableByUid
|
3
|
+
attr_accessor :client_hash
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def initialize(attrs)
|
6
|
+
self.client_hash = attrs.fetch(:client, attrs)
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
[:id, :uid, :name, :urn, :vertical, :street_address_1, :street_address_2,
|
10
|
+
:city, :state, :postal_code, :fax, :email, :tel, :domain_type, :domain].each do |field|
|
11
|
+
define_method(field) { self.client_hash[field] }
|
12
|
+
end
|
13
|
+
|
14
|
+
def locations
|
15
|
+
@locations ||= self.client_hash[:locations].collect { |lh| G5FoundationClient::Location.new(lh.merge(client: self)) }
|
16
|
+
end
|
16
17
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module G5FoundationClient::FindableByUid
|
2
2
|
def find_by_uid(uid)
|
3
|
-
G5FoundationClient::Fetcher.fetch_url(uid) do |
|
4
|
-
|
3
|
+
G5FoundationClient::Fetcher.fetch_url(uid) do |json|
|
4
|
+
new(ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(json)))
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
@@ -1,26 +1,29 @@
|
|
1
1
|
class G5FoundationClient::IntegrationSetting
|
2
|
-
|
2
|
+
attr_accessor :integration_setting_hash
|
3
|
+
attr_accessor :location
|
3
4
|
|
4
|
-
def
|
5
|
-
|
5
|
+
def initialize(attrs)
|
6
|
+
self.integration_setting_hash = attrs
|
7
|
+
self.location = self.integration_setting_hash.delete(:location)
|
6
8
|
end
|
7
9
|
|
8
|
-
attribute :inventory_service_url, String
|
9
|
-
attribute :inventory_service_auth_token, String
|
10
|
-
attribute :etl_strategy_name, String
|
11
|
-
attribute :inventory_vendor_endpoint, String
|
12
|
-
attribute :inventory_vendor_user_name, String
|
13
|
-
attribute :inventory_vendor_password, String
|
14
|
-
attribute :lead_strategy_name, String
|
15
|
-
attribute :lead_vendor_endpoint, String
|
16
|
-
attribute :lead_vendor_user_name, String
|
17
|
-
attribute :lead_vendor_password, String
|
18
|
-
attribute :custom_integration_settings, Hash
|
19
|
-
|
20
10
|
def to_settings_hash
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
self.integration_setting_hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def lead?
|
15
|
+
'lead' == self.vendor_action
|
16
|
+
end
|
17
|
+
|
18
|
+
def inventory?
|
19
|
+
'inventory' == self.vendor_action
|
20
|
+
end
|
21
|
+
|
22
|
+
[:vendor_action, :strategy_name, :vendor_endpoint, :vendor_user_name, :vendor_password].each do |field|
|
23
|
+
define_method(field) { self.integration_setting_hash[field] }
|
24
|
+
end
|
25
|
+
|
26
|
+
def vendor_action
|
27
|
+
self.integration_setting_hash[:vendor_action]
|
25
28
|
end
|
26
29
|
end
|
@@ -1,28 +1,63 @@
|
|
1
1
|
class G5FoundationClient::Location
|
2
|
-
include Virtus.model
|
3
2
|
extend G5FoundationClient::FindableByUid
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
attr_accessor :location_hash
|
5
|
+
|
6
|
+
def initialize(attrs)
|
7
|
+
self.location_hash = attrs.fetch(:location, attrs)
|
8
|
+
end
|
9
|
+
|
10
|
+
[:id, :uid, :client, :client_uid, :client_id, :name, :corporate, :created_at, :updated_at, :urn,
|
11
|
+
:street_address_1, :street_address_2, :city, :state, :postal_code,
|
12
|
+
:fax, :email, :hours, :twitter_username, :facebook_username, :yelp_username,
|
13
|
+
:pinterest_username, :foursquare_username, :tumblr_username, :instagram_username,
|
14
|
+
:vimeo_username, :youtube_username, :domain, :phone_number, :neighborhood, :boat_storage,
|
15
|
+
:business_storage, :gate_access, :security_monitoring, :business_center, :climate_controlled,
|
16
|
+
:heated_cooled, :friendly_staff, :covered_drivethru, :covered_loading, :rv_boat_storage,
|
17
|
+
:outside_parking, :deliveries, :dollies_carts, :digital_surveillance, :drive_up_access,
|
18
|
+
:electronic_gate, :uhaul_trucks, :budget_trucks, :moving_trucks, :free_truck, :fenced_lighted,
|
19
|
+
:ground_level_units, :high_ceilings, :individual_alarmed_units, :mail_boxes, :major_credit_cards,
|
20
|
+
:military_discounts, :student_discount, :senior_discount, :month_to_month, :no_admin_fee, :no_deposits,
|
21
|
+
:no_late_fees, :online_bill_pay, :packing_moving_supplies, :boxes_locks, :tenant_insurance, :truck_rentals,
|
22
|
+
:wide_driveways, :wine_storage, :other_features, :rv_storage, :seven_day_access, :other_storage,
|
23
|
+
:specific_demographic, :primary_offering, :secondary_other, :secondary_condo, :secondary_townhomes, :secondary_apartments, :floor_plans,
|
24
|
+
:nearby_schools, :highrise_structure, :garden_structure, :townhome_structure, :modern_structure, :nearby_employers, :dogs_allowed,
|
25
|
+
:cats_allowed, :accessibility, :air_conditioned, :cable_included, :ceiling_fans, :custom_cabinetry, :dishwasher,
|
26
|
+
:energy_efficient, :fireplace, :granite_counters, :hardwood_floors, :private_balcony, :private_patio, :refrigerator,
|
27
|
+
:stainless_appliances, :smoke_free, :style_design, :style_cost, :walkin_closet, :washer_dryer, :has_view, :other_amenities,
|
28
|
+
:carport_parking, :club_house, :dog_park, :corporate_suites, :family_friendly, :fitness_center, :furnished_apartments, :garages,
|
29
|
+
:gated_entrance, :laundry_facilities, :online_rental_payments, :onsite_management, :close_park, :pet_friendly, :playground,
|
30
|
+
:recycling_center, :swimming_pool, :hot_tub, :storage_available, :tennis_court, :wifi_available, :other_community_amenities,
|
31
|
+
:primary_offering_other, :ga_tracking_id, :ga_profile_id, :landmark_1_type, :landmark_1_name, :landmark_2_type, :landmark_2_name,
|
32
|
+
:property_feature_1, :property_feature_2, :property_feature_3, :apartment_amenity_1, :apartment_amenity_2,
|
33
|
+
:community_amenity_1, :community_amenity_2].each do |field|
|
34
|
+
define_method(field) { self.location_hash[field] }
|
35
|
+
end
|
36
|
+
|
37
|
+
alias_method :locality, :city
|
38
|
+
alias_method :region, :state
|
39
|
+
alias_method :primary_landmark, :landmark_1_name
|
40
|
+
alias_method :primary_amenity, :apartment_amenity_1
|
41
|
+
|
42
|
+
|
43
|
+
def street_address
|
44
|
+
return street_address_1 if street_address_2.blank?
|
45
|
+
"#{street_address_1}\n#{street_address_2}"
|
7
46
|
end
|
8
47
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
attribute :street_address, String
|
25
|
-
attribute :region, String
|
26
|
-
attribute :locality, String
|
27
|
-
attribute :postal_code, String
|
48
|
+
def integration_settings
|
49
|
+
@integration_settings ||= self.location_hash.fetch(:locations_integration_settings, []).collect { |is| G5FoundationClient::IntegrationSetting.new(is.merge(location: self)) }
|
50
|
+
end
|
51
|
+
|
52
|
+
def inventory_integration_settings
|
53
|
+
inventory_integration_setting_by_vendor_action :inventory?
|
54
|
+
end
|
55
|
+
|
56
|
+
def lead_integration_settings
|
57
|
+
inventory_integration_setting_by_vendor_action :lead?
|
58
|
+
end
|
59
|
+
|
60
|
+
def inventory_integration_setting_by_vendor_action(vendor_action)
|
61
|
+
integration_settings.detect { |is| is.send(vendor_action) }
|
62
|
+
end
|
28
63
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"client":{"id":2,"uid":"http://192.168.33.30:3000/clients/g5-c-6hng302-no-store","name":"no store","urn":"g5-c-6hng302-no-store","vertical":"Self-Storage","street_address_1":"20270 W North Ave","street_address_2":"","city":"Brookfield","state":"WI","postal_code":"53045-4278","fax":"(262) 744-9458","email":"perry@hertler.org","tel":"(262) 744-9458","domain_type":"SingleDomainClient","domain":"http://nostore.com","created_at":"2014-10-08T20:27:36.008Z","updated_at":"2014-10-08T20:27:36.008Z","locations":[{"id":3,"uid":"http://192.168.33.30:3000/clients/g5-c-6hng302-no-store/locations/g5-cl-6hng303-brussels","client_id":2,"client_uid":"http://192.168.33.30:3000/clients/g5-c-6hng302-no-store","name":"brussels","corporate":false,"created_at":"2014-10-08T20:27:36.011Z","updated_at":"2014-10-08T20:27:36.011Z","urn":"g5-cl-6hng303-brussels","street_address_1":"20270 W North Ave","street_address_2":"","city":"Brookfield","state":"WI","postal_code":"53045-4278","fax":"(262) 744-9458","email":"perry@hertler.org","hours":"","twitter_username":"","facebook_username":"","yelp_username":"","pinterest_username":"","foursquare_username":"","tumblr_username":"","instagram_username":"","vimeo_username":"","youtube_username":"","domain":"http://nostore.com/brussels","phone_number":"(262) 744-9458","neighborhood":"","boat_storage":false,"business_storage":false,"gate_access":false,"security_monitoring":false,"business_center":false,"climate_controlled":false,"heated_cooled":false,"friendly_staff":false,"covered_drivethru":false,"covered_loading":false,"rv_boat_storage":false,"outside_parking":false,"deliveries":false,"dollies_carts":false,"digital_surveillance":false,"drive_up_access":false,"electronic_gate":false,"uhaul_trucks":false,"budget_trucks":false,"moving_trucks":false,"free_truck":false,"fenced_lighted":false,"ground_level_units":false,"high_ceilings":false,"individual_alarmed_units":false,"mail_boxes":false,"major_credit_cards":false,"military_discounts":false,"student_discount":false,"senior_discount":false,"month_to_month":false,"no_admin_fee":false,"no_deposits":false,"no_late_fees":false,"online_bill_pay":false,"packing_moving_supplies":false,"boxes_locks":false,"tenant_insurance":false,"truck_rentals":false,"wide_driveways":false,"wine_storage":false,"other_features":"","rv_storage":false,"seven_day_access":false,"other_storage":"","specific_demographic":"","primary_offering":"","secondary_other":"","secondary_condo":false,"secondary_townhomes":false,"secondary_apartments":false,"floor_plans":"","nearby_schools":"","highrise_structure":false,"garden_structure":false,"townhome_structure":false,"modern_structure":false,"nearby_employers":"","dogs_allowed":false,"cats_allowed":false,"accessibility":"0","air_conditioned":false,"cable_included":false,"ceiling_fans":false,"custom_cabinetry":false,"dishwasher":false,"energy_efficient":false,"fireplace":false,"granite_counters":false,"hardwood_floors":false,"private_balcony":false,"private_patio":false,"refrigerator":false,"stainless_appliances":false,"smoke_free":false,"style_design":"","style_cost":"","walkin_closet":false,"washer_dryer":false,"has_view":false,"other_amenities":"","carport_parking":false,"club_house":false,"dog_park":false,"corporate_suites":false,"family_friendly":false,"fitness_center":false,"furnished_apartments":false,"garages":false,"gated_entrance":false,"laundry_facilities":false,"online_rental_payments":false,"onsite_management":false,"close_park":false,"pet_friendly":false,"playground":false,"recycling_center":false,"swimming_pool":false,"hot_tub":false,"storage_available":false,"tennis_court":false,"wifi_available":false,"other_community_amenities":"","primary_offering_other":null,"ga_tracking_id":"","ga_profile_id":"","landmark_1_type":"","landmark_1_name":"","landmark_2_type":"","landmark_2_name":"","property_feature_1":"","property_feature_2":"","property_feature_3":"","apartment_amenity_1":"","apartment_amenity_2":"","community_amenity_1":"","community_amenity_2":"","locations_integration_settings":[{"location_id":3,"vendor":"SiteLink","vendor_action":"inventory","id":2,"strategy_name":"vsn","vendor_user_name":"brusselsuname","vendor_password":"vp","vendor_endpoint":"ven","created_at":"2014-10-08T20:28:26.154Z","updated_at":"2014-10-08T20:28:26.154Z","channel":"4"}]}]}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"location":{"id":3,"uid":"http://192.168.33.30:3000/clients/g5-c-6hng302-no-store/locations/g5-cl-6hng303-brussels","client_id":2,"client_uid":"http://192.168.33.30:3000/clients/g5-c-6hng302-no-store","name":"brussels","corporate":false,"created_at":"2014-10-08T20:27:36.011Z","updated_at":"2014-10-08T20:27:36.011Z","urn":"g5-cl-6hng303-brussels","street_address_1":"20270 W North Ave","street_address_2":"","city":"Brookfield","state":"WI","postal_code":"53045-4278","fax":"(262) 744-9458","email":"perry@hertler.org","hours":"","twitter_username":"","facebook_username":"","yelp_username":"","pinterest_username":"","foursquare_username":"","tumblr_username":"","instagram_username":"","vimeo_username":"","youtube_username":"","domain":"http://nostore.com/brussels","phone_number":"(262) 744-9458","neighborhood":"","boat_storage":false,"business_storage":false,"gate_access":false,"security_monitoring":false,"business_center":false,"climate_controlled":false,"heated_cooled":false,"friendly_staff":false,"covered_drivethru":false,"covered_loading":false,"rv_boat_storage":false,"outside_parking":false,"deliveries":false,"dollies_carts":false,"digital_surveillance":false,"drive_up_access":false,"electronic_gate":false,"uhaul_trucks":false,"budget_trucks":false,"moving_trucks":false,"free_truck":false,"fenced_lighted":false,"ground_level_units":false,"high_ceilings":false,"individual_alarmed_units":false,"mail_boxes":false,"major_credit_cards":false,"military_discounts":false,"student_discount":false,"senior_discount":false,"month_to_month":false,"no_admin_fee":false,"no_deposits":false,"no_late_fees":false,"online_bill_pay":false,"packing_moving_supplies":false,"boxes_locks":false,"tenant_insurance":false,"truck_rentals":false,"wide_driveways":false,"wine_storage":false,"other_features":"","rv_storage":false,"seven_day_access":false,"other_storage":"","specific_demographic":"","primary_offering":"","secondary_other":"","secondary_condo":false,"secondary_townhomes":false,"secondary_apartments":false,"floor_plans":"","nearby_schools":"","highrise_structure":false,"garden_structure":false,"townhome_structure":false,"modern_structure":false,"nearby_employers":"","dogs_allowed":false,"cats_allowed":false,"accessibility":"0","air_conditioned":false,"cable_included":false,"ceiling_fans":false,"custom_cabinetry":false,"dishwasher":false,"energy_efficient":false,"fireplace":false,"granite_counters":false,"hardwood_floors":false,"private_balcony":false,"private_patio":false,"refrigerator":false,"stainless_appliances":false,"smoke_free":false,"style_design":"","style_cost":"","walkin_closet":false,"washer_dryer":false,"has_view":false,"other_amenities":"","carport_parking":false,"club_house":false,"dog_park":false,"corporate_suites":false,"family_friendly":false,"fitness_center":false,"furnished_apartments":false,"garages":false,"gated_entrance":false,"laundry_facilities":false,"online_rental_payments":false,"onsite_management":false,"close_park":false,"pet_friendly":false,"playground":false,"recycling_center":false,"swimming_pool":false,"hot_tub":false,"storage_available":false,"tennis_court":false,"wifi_available":false,"other_community_amenities":"","primary_offering_other":null,"ga_tracking_id":"","ga_profile_id":"","landmark_1_type":"","landmark_1_name":"","landmark_2_type":"","landmark_2_name":"","property_feature_1":"","property_feature_2":"","property_feature_3":"","apartment_amenity_1":"","apartment_amenity_2":"","community_amenity_1":"","community_amenity_2":"","locations_integration_settings":[{"location_id":3,"vendor":"SiteLink","vendor_action":"inventory","id":2,"strategy_name":"vsn","vendor_user_name":"brusselsuname","vendor_password":"vp","vendor_endpoint":"ven","created_at":"2014-10-08T20:28:26.154Z","updated_at":"2014-10-08T20:28:26.154Z","channel":"4"}]}}
|
@@ -42,17 +42,17 @@ describe G5FoundationClient::Client do
|
|
42
42
|
it "instantiates associated Locations" do
|
43
43
|
expect(client.locations.length).to eq(2)
|
44
44
|
expect(client.locations.all? { |l| l.is_a?(G5FoundationClient::Location) }).to be_true
|
45
|
-
expect(client.locations.map(&:name)).to eq([
|
45
|
+
expect(client.locations.map(&:name)).to eq([ 'Location 1', 'Location 2'])
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe ".find_by_uid" do
|
51
|
-
let(:uid) {
|
52
|
-
let(:response) { fixture(
|
53
|
-
before { stub_json(uid +
|
51
|
+
let(:uid) { 'http://example.com/clients/g5-c-1234-client' }
|
52
|
+
let(:response) { fixture('hub-client.json') }
|
53
|
+
before { stub_json(uid + '?access_token=token', response) }
|
54
54
|
subject(:find) { G5FoundationClient::Client.find_by_uid(uid) }
|
55
55
|
|
56
|
-
its(:name) { should eq(
|
56
|
+
its(:name) { should eq('no store') }
|
57
57
|
end
|
58
58
|
end
|
@@ -4,46 +4,47 @@ describe G5FoundationClient::IntegrationSetting do
|
|
4
4
|
before { G5FoundationClient.access_token = 'token' }
|
5
5
|
|
6
6
|
describe 'instantiating with a hash' do
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
let(:
|
12
|
-
let(:
|
13
|
-
let(:
|
14
|
-
let(:lead_vendor_endpoint) { 'http://sitelink.example.com' }
|
15
|
-
let(:lead_vendor_user_name) { 'sluname' }
|
16
|
-
let(:lead_vendor_password) { 'slpw' }
|
7
|
+
let(:service_url) { 'http://inventory.service.example.com' }
|
8
|
+
let(:location) { 'location' }
|
9
|
+
let(:strategy_name) { 'Centershift' }
|
10
|
+
let(:vendor_endpoint) { 'http://centershift.example.com' }
|
11
|
+
let(:vendor_user_name) { 'uname' }
|
12
|
+
let(:vendor_password) { 'pw' }
|
13
|
+
let(:vendor_action) { 'inventory' }
|
17
14
|
let(:custom_integration_settings) { {foo: 'bar'} }
|
18
|
-
let(:init_hash) { {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
lead_vendor_password: lead_vendor_password,
|
28
|
-
custom_integration_settings: custom_integration_settings} }
|
29
|
-
let(:expected_to_settings_hash) do
|
30
|
-
expected = init_hash.clone
|
31
|
-
custom = expected.delete(:custom_integration_settings)
|
32
|
-
expected.merge(custom)
|
33
|
-
end
|
15
|
+
let(:init_hash) { {service_url: service_url,
|
16
|
+
location: location,
|
17
|
+
strategy_name: strategy_name,
|
18
|
+
vendor_endpoint: vendor_endpoint,
|
19
|
+
vendor_user_name: vendor_user_name,
|
20
|
+
vendor_password: vendor_password,
|
21
|
+
vendor_action: 'inventory'
|
22
|
+
} }
|
23
|
+
|
34
24
|
subject { G5FoundationClient::IntegrationSetting.new(init_hash) }
|
35
25
|
|
36
|
-
its(:
|
37
|
-
its(:
|
38
|
-
its(:
|
39
|
-
its(:
|
40
|
-
its(:
|
41
|
-
its(:
|
42
|
-
its(:
|
43
|
-
its(:
|
44
|
-
its(:
|
45
|
-
|
46
|
-
|
47
|
-
|
26
|
+
its(:location) { should eql(location) }
|
27
|
+
its(:vendor_action) { should eql(vendor_action) }
|
28
|
+
its(:vendor_endpoint) { should eql(vendor_endpoint) }
|
29
|
+
its(:vendor_user_name) { should eql(vendor_user_name) }
|
30
|
+
its(:vendor_password) { should eql(vendor_password) }
|
31
|
+
its(:strategy_name) { should eql(strategy_name) }
|
32
|
+
its(:to_settings_hash) { should eq(init_hash) }
|
33
|
+
its(:inventory?) { should be_true }
|
34
|
+
its(:lead?) { should be_false }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'vendor actions' do
|
38
|
+
context 'inventory' do
|
39
|
+
subject { G5FoundationClient::IntegrationSetting.new(vendor_action: 'inventory') }
|
40
|
+
its(:inventory?) { should be_true }
|
41
|
+
its(:lead?) { should be_false }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'lead' do
|
45
|
+
subject { G5FoundationClient::IntegrationSetting.new(vendor_action: 'lead') }
|
46
|
+
its(:inventory?) { should be_false }
|
47
|
+
its(:lead?) { should be_true }
|
48
|
+
end
|
48
49
|
end
|
49
50
|
end
|
@@ -6,24 +6,24 @@ describe G5FoundationClient::Location do
|
|
6
6
|
describe "instantiating with a hash" do
|
7
7
|
subject do
|
8
8
|
G5FoundationClient::Location.new(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
uid: "http://example.com/urn",
|
10
|
+
urn: "urn",
|
11
|
+
client_uid: "http://example.com/client_uid",
|
12
|
+
name: "Test Name",
|
13
|
+
phone_number: "123-123-1234",
|
14
|
+
domain: "example.com",
|
15
|
+
corporate: "true",
|
16
|
+
floor_plans: "Apartments",
|
17
|
+
apartment_amenity_1: "Pony Rides",
|
18
|
+
landmark_1_name: "An enormous bust of Brett Favre",
|
19
|
+
ga_tracking_id: "UA-1234-5",
|
20
|
+
ga_profile_id: "ga:1234",
|
21
|
+
neighborhood: "Wrong side of the tracks",
|
22
|
+
street_address_1: "123 Test Way",
|
23
|
+
street_address_2: "apt 2",
|
24
|
+
state: "South Testakota",
|
25
|
+
city: "Testville",
|
26
|
+
postal_code: "31337"
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
@@ -37,24 +37,28 @@ describe G5FoundationClient::Location do
|
|
37
37
|
its(:floor_plans) { should eql("Apartments") }
|
38
38
|
its(:primary_amenity) { should eql("Pony Rides") }
|
39
39
|
its(:primary_landmark) { should eql("An enormous bust of Brett Favre") }
|
40
|
-
its(:qualifier) { should eql("I have no idea what a qualifier is") }
|
41
40
|
its(:ga_tracking_id) { should eql("UA-1234-5") }
|
42
41
|
its(:ga_profile_id) { should eql("ga:1234") }
|
43
42
|
its(:neighborhood) { should eql("Wrong side of the tracks") }
|
44
|
-
its(:street_address) { should eql("123 Test Way") }
|
43
|
+
its(:street_address) { should eql("123 Test Way\napt 2") }
|
45
44
|
its(:region) { should eql("South Testakota") }
|
46
45
|
its(:locality) { should eql("Testville") }
|
47
46
|
its(:postal_code) { should eql("31337") }
|
47
|
+
its(:inventory_integration_settings) { should be_nil }
|
48
|
+
its(:lead_integration_settings) { should be_nil }
|
48
49
|
end
|
49
50
|
|
50
|
-
describe
|
51
|
+
describe '.find_by_uid' do
|
51
52
|
let(:uid) do
|
52
|
-
|
53
|
+
'http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location'
|
53
54
|
end
|
54
|
-
let(:response) { fixture(
|
55
|
-
before { stub_json(uid +
|
55
|
+
let(:response) { fixture('hub-location.json') }
|
56
|
+
before { stub_json(uid + '?access_token=token', response) }
|
56
57
|
subject(:find) { G5FoundationClient::Location.find_by_uid(uid) }
|
57
58
|
|
58
|
-
its(:name) { should eq(
|
59
|
+
its(:name) { should eq('brussels') }
|
60
|
+
it 'has inventory integration settings' do
|
61
|
+
subject.inventory_integration_settings.integration_setting_hash[:strategy_name].should eq('vsn')
|
62
|
+
end
|
59
63
|
end
|
60
64
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_foundation_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Petersen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: microformats2
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: g5_authentication_client
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,10 +138,6 @@ files:
|
|
152
138
|
- Rakefile
|
153
139
|
- g5_foundation_client.gemspec
|
154
140
|
- lib/g5_foundation_client.rb
|
155
|
-
- lib/g5_foundation_client/deserializers/client.rb
|
156
|
-
- lib/g5_foundation_client/deserializers/integration_setting.rb
|
157
|
-
- lib/g5_foundation_client/deserializers/location.rb
|
158
|
-
- lib/g5_foundation_client/deserializers/safe_access.rb
|
159
141
|
- lib/g5_foundation_client/fetcher.rb
|
160
142
|
- lib/g5_foundation_client/models/client.rb
|
161
143
|
- lib/g5_foundation_client/models/findable_by_uid.rb
|
@@ -165,12 +147,8 @@ files:
|
|
165
147
|
- lib/g5_foundation_client/rspec.rb
|
166
148
|
- lib/g5_foundation_client/rspec/factories.rb
|
167
149
|
- lib/g5_foundation_client/version.rb
|
168
|
-
- spec/fixtures/
|
169
|
-
- spec/fixtures/
|
170
|
-
- spec/fixtures/location_detail.html
|
171
|
-
- spec/lib/g5_foundation_client/deserializers/client_spec.rb
|
172
|
-
- spec/lib/g5_foundation_client/deserializers/integration_setting_spec.rb
|
173
|
-
- spec/lib/g5_foundation_client/deserializers/location_spec.rb
|
150
|
+
- spec/fixtures/hub-client.json
|
151
|
+
- spec/fixtures/hub-location.json
|
174
152
|
- spec/lib/g5_foundation_client/fetcher_spec.rb
|
175
153
|
- spec/lib/g5_foundation_client/models/client_spec.rb
|
176
154
|
- spec/lib/g5_foundation_client/models/integration_setting_spec.rb
|
@@ -202,12 +180,8 @@ signing_key:
|
|
202
180
|
specification_version: 4
|
203
181
|
summary: Client gem to interact with G5 services.
|
204
182
|
test_files:
|
205
|
-
- spec/fixtures/
|
206
|
-
- spec/fixtures/
|
207
|
-
- spec/fixtures/location_detail.html
|
208
|
-
- spec/lib/g5_foundation_client/deserializers/client_spec.rb
|
209
|
-
- spec/lib/g5_foundation_client/deserializers/integration_setting_spec.rb
|
210
|
-
- spec/lib/g5_foundation_client/deserializers/location_spec.rb
|
183
|
+
- spec/fixtures/hub-client.json
|
184
|
+
- spec/fixtures/hub-location.json
|
211
185
|
- spec/lib/g5_foundation_client/fetcher_spec.rb
|
212
186
|
- spec/lib/g5_foundation_client/models/client_spec.rb
|
213
187
|
- spec/lib/g5_foundation_client/models/integration_setting_spec.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module G5FoundationClient::Deserializers
|
2
|
-
module Client
|
3
|
-
extend SafeAccess
|
4
|
-
|
5
|
-
def self.from_markup(markup)
|
6
|
-
h = Microformats2.parse(markup).cards.first
|
7
|
-
client = G5FoundationClient::Client.new(
|
8
|
-
uid: with_safe_access { h.uid },
|
9
|
-
urn: with_safe_access { h.g5_urn },
|
10
|
-
name: with_safe_access { h.name },
|
11
|
-
vertical: with_safe_access { h.g5_vertical },
|
12
|
-
domain: with_safe_access { h.g5_domain },
|
13
|
-
domain_type: with_safe_access { h.g5_domain_type }
|
14
|
-
)
|
15
|
-
|
16
|
-
location_formats = with_safe_access(stringify: false) { h.orgs.map(&:format) }
|
17
|
-
location_formats ||= []
|
18
|
-
location_formats.each do |hcard|
|
19
|
-
client.locations << G5FoundationClient::Deserializers::Location.from_hcard(hcard)
|
20
|
-
end
|
21
|
-
|
22
|
-
client
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module G5FoundationClient::Deserializers
|
2
|
-
module IntegrationSetting
|
3
|
-
extend SafeAccess
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def from_hcard(hcard)
|
7
|
-
G5FoundationClient::IntegrationSetting.new(hcard_to_hash(hcard))
|
8
|
-
end
|
9
|
-
|
10
|
-
def hcard_to_hash(h)
|
11
|
-
{
|
12
|
-
inventory_service_url: with_safe_access { h.g5_inventory_service_url },
|
13
|
-
inventory_service_auth_token: with_safe_access { h.g5_inventory_service_auth_token },
|
14
|
-
etl_strategy_name: with_safe_access { h.g5_etl_strategy_name },
|
15
|
-
inventory_vendor_endpoint: with_safe_access { h.g5_inventory_vendor_endpoint },
|
16
|
-
inventory_vendor_user_name: with_safe_access { h.g5_inventory_vendor_user_name },
|
17
|
-
inventory_vendor_password: with_safe_access { h.g5_inventory_vendor_password },
|
18
|
-
lead_strategy_name: with_safe_access { h.g5_lead_strategy_name },
|
19
|
-
lead_vendor_endpoint: with_safe_access { h.g5_lead_vendor_endpoint },
|
20
|
-
lead_vendor_user_name: with_safe_access { h.g5_lead_vendor_user_name },
|
21
|
-
lead_vendor_password: with_safe_access { h.g5_lead_vendor_password },
|
22
|
-
custom_integration_settings: custom_integration_settings_from_hcard(h)
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def num_custom_elements(hcard)
|
27
|
-
hcard.methods.collect(&:to_s).count { |setting| setting =~ /g5_custom_integration_setting_name_\d+$/ }
|
28
|
-
end
|
29
|
-
|
30
|
-
def custom_integration_settings_from_hcard(hcard)
|
31
|
-
custom_settings = Hash.new
|
32
|
-
|
33
|
-
num_custom_elements(hcard).times do |index|
|
34
|
-
name = with_safe_access { hcard.send("g5_custom_integration_setting_name_#{index}") }
|
35
|
-
value = with_safe_access { hcard.send("g5_custom_integration_setting_value_#{index}") }
|
36
|
-
custom_settings[name.to_sym] = value
|
37
|
-
end
|
38
|
-
custom_settings
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module G5FoundationClient::Deserializers
|
2
|
-
module Location
|
3
|
-
extend SafeAccess
|
4
|
-
|
5
|
-
def self.from_markup(markup)
|
6
|
-
hcard = Microformats2.parse(markup).cards.first
|
7
|
-
from_hcard(hcard)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.from_hcard(hcard)
|
11
|
-
G5FoundationClient::Location.new(hcard_to_hash(hcard).merge(integration_setting: IntegrationSetting.from_hcard(hcard)))
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.hcard_to_hash(h)
|
15
|
-
{
|
16
|
-
uid: with_safe_access { h.uid },
|
17
|
-
urn: with_safe_access { h.g5_urn },
|
18
|
-
client_uid: with_safe_access { h.org.format.uid.to_s},
|
19
|
-
name: with_safe_access { h.name },
|
20
|
-
phone_number: with_safe_access { h.adr.format.tel },
|
21
|
-
domain: with_safe_access { h.g5_domain },
|
22
|
-
corporate: with_safe_access { h.g5_corporate },
|
23
|
-
floor_plans: with_safe_access { h.g5_floorplan },
|
24
|
-
primary_amenity: with_safe_access { h.g5_aparment_amenity_1 },
|
25
|
-
qualifier: with_safe_access { h.g5_aparment_feature_1 },
|
26
|
-
primary_landmark: with_safe_access { h.g5_landmark_1 },
|
27
|
-
ga_tracking_id: with_safe_access { h.ga_tracking_id },
|
28
|
-
ga_profile_id: with_safe_access { h.ga_profile_id },
|
29
|
-
neighborhood: with_safe_access { h.adr.format.g5_neighborhood },
|
30
|
-
street_address: with_safe_access { h.adr.format.street_address },
|
31
|
-
region: with_safe_access { h.adr.format.region },
|
32
|
-
locality: with_safe_access { h.adr.format.locality },
|
33
|
-
postal_code: with_safe_access { h.adr.format.postal_code }
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module G5FoundationClient::Deserializers
|
2
|
-
module SafeAccess
|
3
|
-
def with_safe_access(options = {}, &block)
|
4
|
-
options[:stringify] = true if options[:stringify] == nil
|
5
|
-
|
6
|
-
result = block.call
|
7
|
-
options[:stringify] ? result.to_s : result
|
8
|
-
rescue NoMethodError
|
9
|
-
nil
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,220 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head></head>
|
4
|
-
<body>
|
5
|
-
<article>
|
6
|
-
<div class="h-card">
|
7
|
-
<h2>
|
8
|
-
<a class="p-name u-uid u-url" href="http://example.com/clients/g5-c-1234-client">Test Client</a>
|
9
|
-
<small class="p-g5-vertical">Apartments</small>
|
10
|
-
|
|
11
|
-
<small class="u-g5-domain">http://example.com/</small>
|
12
|
-
|
|
13
|
-
<small class="p-g5-domain-type">MultiDomainClient</small>
|
14
|
-
<small class="p-g5-urn">g5-c-1234-client</small>
|
15
|
-
</h2>
|
16
|
-
<p class="p-adr h-adr">
|
17
|
-
<span class="p-street-address">
|
18
|
-
455 NW Franklin
|
19
|
-
|
20
|
-
</span>
|
21
|
-
<span>
|
22
|
-
<span class="p-locality">Bend</span>
|
23
|
-
<span class="p-region">OR</span>
|
24
|
-
<span class="p-postal-code">97701</span>
|
25
|
-
</span>
|
26
|
-
<span class="p-tel p-fax"></span>
|
27
|
-
<span class="u-email"></span>
|
28
|
-
</p>
|
29
|
-
|
30
|
-
<div>
|
31
|
-
<h4>Locations</h4>
|
32
|
-
<ul class="list-unstyled">
|
33
|
-
<li class="p-org h-card">
|
34
|
-
<a class="p-name u-uid u-url"
|
35
|
-
href="http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location">Test Location
|
36
|
-
1</a>
|
37
|
-
<a class="u-url u-g5-domain" href="http://www.salidadelsolapartments.com">http://www.salidadelsolapartments.com</a>
|
38
|
-
|
39
|
-
<p class="p-adr h-adr">
|
40
|
-
<span class="p-street-address">
|
41
|
-
1125 Sunrise Blvd.
|
42
|
-
|
43
|
-
</span>
|
44
|
-
<span class="p-g5-neighborhood">West</span>
|
45
|
-
<span>
|
46
|
-
<span class="p-locality">Ventura</span>
|
47
|
-
<span class="p-region">CA</span>
|
48
|
-
<span class="p-postal-code">93001</span>
|
49
|
-
</span>
|
50
|
-
<span class="p-tel">805-798-1256</span>
|
51
|
-
<span class="p-tel p-fax"></span>
|
52
|
-
<span class="u-email">info@salidadelsolapts.com</span>
|
53
|
-
</p>
|
54
|
-
|
55
|
-
<p>
|
56
|
-
<strong>Corporate:</strong>
|
57
|
-
<br/>
|
58
|
-
<span class="p-g5-corporate">false</span>
|
59
|
-
</p>
|
60
|
-
|
61
|
-
<p>
|
62
|
-
<strong>Floor Plans:</strong>
|
63
|
-
<br/>
|
64
|
-
<span class="p-g5-floorplan">1, 2, 3, studio Apartments</span>
|
65
|
-
</p>
|
66
|
-
|
67
|
-
<p>
|
68
|
-
<strong>Landmarks:</strong>
|
69
|
-
<br/>
|
70
|
-
<span class="p-g5-landmark-1">Venture Marina</span>
|
71
|
-
<br/>
|
72
|
-
<span class="p-g5-landmark-2">River Ridge Golf Course</span>
|
73
|
-
</p>
|
74
|
-
|
75
|
-
<p>
|
76
|
-
<strong>Property Features or Qualifiers:</strong>
|
77
|
-
<br/>
|
78
|
-
<span class="p-g5-aparment-feature-1">Luxury</span>
|
79
|
-
<br/>
|
80
|
-
<span class="p-g5-aparment-feature-2">Gated</span>
|
81
|
-
<br/>
|
82
|
-
<span class="p-g5-aparment-feature-3"></span>
|
83
|
-
</p>
|
84
|
-
|
85
|
-
<p>
|
86
|
-
<strong>Primary Amenities:</strong>
|
87
|
-
<br/>
|
88
|
-
<span class="p-g5-aparment-amenity-1">Stainless Steel Appliances</span>
|
89
|
-
<br/>
|
90
|
-
<span class="p-g5-community-amenity-1">Fitness Center</span>
|
91
|
-
</p>
|
92
|
-
|
93
|
-
<h4>Client</h4>
|
94
|
-
|
95
|
-
<p class="p-org h-card">
|
96
|
-
<a class="p-name u-uid u-url" href="http://example.com/clients/g5-c-1234-client">Test Client</a>
|
97
|
-
</p>
|
98
|
-
</li>
|
99
|
-
<li class="p-org h-card">
|
100
|
-
<a class="p-name u-uid u-url"
|
101
|
-
href="http://g5-hub.herokuapp.com/clients/g5-c-1servrzr-luxe-apartment-company/locations/g5-cl-1servrzz-depot-17">Depot
|
102
|
-
17</a>
|
103
|
-
<a class="u-url u-g5-domain" href="http://www.depot17apartments.com">http://www.depot17apartments.com</a>
|
104
|
-
|
105
|
-
<p class="p-adr h-adr">
|
106
|
-
<span class="p-street-address">
|
107
|
-
2675 Station St.
|
108
|
-
|
109
|
-
</span>
|
110
|
-
<span class="p-g5-neighborhood">Park Slope</span>
|
111
|
-
<span>
|
112
|
-
<span class="p-locality">Brooklyn</span>
|
113
|
-
<span class="p-region">NY</span>
|
114
|
-
<span class="p-postal-code">11215</span>
|
115
|
-
</span>
|
116
|
-
<span class="p-tel">718-639-3915</span>
|
117
|
-
<span class="p-tel p-fax"></span>
|
118
|
-
<span class="u-email">info@depot17.com</span>
|
119
|
-
</p>
|
120
|
-
|
121
|
-
<p>
|
122
|
-
<strong>Corporate:</strong>
|
123
|
-
<br/>
|
124
|
-
<span class="p-g5-corporate">false</span>
|
125
|
-
</p>
|
126
|
-
|
127
|
-
<p>
|
128
|
-
<strong>Floor Plans:</strong>
|
129
|
-
<br/>
|
130
|
-
<span class="p-g5-floorplan"> Apartments</span>
|
131
|
-
</p>
|
132
|
-
|
133
|
-
<p>
|
134
|
-
<strong>Landmarks:</strong>
|
135
|
-
<br/>
|
136
|
-
<span class="p-g5-landmark-1"></span>
|
137
|
-
<br/>
|
138
|
-
<span class="p-g5-landmark-2"></span>
|
139
|
-
</p>
|
140
|
-
|
141
|
-
<p>
|
142
|
-
<strong>Property Features or Qualifiers:</strong>
|
143
|
-
<br/>
|
144
|
-
<span class="p-g5-aparment-feature-1"></span>
|
145
|
-
<br/>
|
146
|
-
<span class="p-g5-aparment-feature-2"></span>
|
147
|
-
<br/>
|
148
|
-
<span class="p-g5-aparment-feature-3"></span>
|
149
|
-
</p>
|
150
|
-
|
151
|
-
<p>
|
152
|
-
<strong>Primary Amenities:</strong>
|
153
|
-
<br/>
|
154
|
-
<span class="p-g5-aparment-amenity-1"></span>
|
155
|
-
<br/>
|
156
|
-
<span class="p-g5-community-amenity-1"></span>
|
157
|
-
</p>
|
158
|
-
|
159
|
-
<div>
|
160
|
-
<h4>
|
161
|
-
<a href="http://192.168.33.30:3000/locations/g5-cl-6hc1xfr-perry-hertler/integration_settings/1/edit">Integration
|
162
|
-
Settings</a>
|
163
|
-
</h4>
|
164
|
-
<dl class="dl-horizontal">
|
165
|
-
<dt>Inventory Service URL</dt>
|
166
|
-
<dd class="p-g5-inventory-service-url">http://localhost:5777/api/v1/storage_facilities</dd>
|
167
|
-
|
168
|
-
<dt>Inventory Service Auth Token</dt>
|
169
|
-
<dd class="p-g5-inventory-service-auth-token">
|
170
|
-
authtoken
|
171
|
-
</dd>
|
172
|
-
|
173
|
-
<dt>ETL Strategy Name</dt>
|
174
|
-
<dd class="p-g5-etl-strategy-name">EtlStrategies::Centershift4</dd>
|
175
|
-
|
176
|
-
<dt>Inventory Vendor Endpoint</dt>
|
177
|
-
<dd class="p-g5-inventory-vendor-endpoint">https://slc.centershift.com/sandbox40/SWS.asmx?WSDL</dd>
|
178
|
-
|
179
|
-
<dt>Inventory Vendor User Name</dt>
|
180
|
-
<dd class="p-g5-inventory-vendor-user-name">G-5TSite</dd>
|
181
|
-
|
182
|
-
<dt>Inventory Vendor Password</dt>
|
183
|
-
<dd class="p-g5-inventory-vendor-password">1qaz@Wsx</dd>
|
184
|
-
|
185
|
-
<dt>Lead Strategy Name</dt>
|
186
|
-
<dd class="p-g5-lead-strategy-name">LeadStrategies::SiteLink</dd>
|
187
|
-
|
188
|
-
<dt>Lead Vendor Endpoint</dt>
|
189
|
-
<dd class="p-g5-lead-vendor-endpoint">https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL
|
190
|
-
</dd>
|
191
|
-
|
192
|
-
<dt>Lead Vendor User Name</dt>
|
193
|
-
<dd class="p-g5-lead-vendor-user-name">Administrator</dd>
|
194
|
-
|
195
|
-
<dt>Lead Vendor Password</dt>
|
196
|
-
<dd class="p-g5-lead-vendor-password">Demo</dd>
|
197
|
-
|
198
|
-
<dt class=p-g5-custom-integration-setting-name-0>corporate_code</dt>
|
199
|
-
<dd class=p-g5-custom-integration-setting-value-0>1000000129</dd>
|
200
|
-
<dt class=p-g5-custom-integration-setting-name-1>location_code</dt>
|
201
|
-
<dd class=p-g5-custom-integration-setting-value-1>1000000678</dd>
|
202
|
-
<dt class=p-g5-custom-integration-setting-name-2>channel</dt>
|
203
|
-
<dd class=p-g5-custom-integration-setting-value-2>2</dd>
|
204
|
-
</dl>
|
205
|
-
</div>
|
206
|
-
|
207
|
-
|
208
|
-
<h4>Client</h4>
|
209
|
-
|
210
|
-
<p class="p-org h-card">
|
211
|
-
<a class="p-name u-uid u-url" href="http://example.com/clients/g5-c-1234-client">Test Client</a>
|
212
|
-
</p>
|
213
|
-
</li>
|
214
|
-
</ul>
|
215
|
-
</div>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
</article>
|
219
|
-
</body>
|
220
|
-
</html>
|
@@ -1,154 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head></head>
|
4
|
-
<body>
|
5
|
-
<section class="h-card">
|
6
|
-
<h2>
|
7
|
-
<a class="p-name u-uid u-url" href="http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location">Test
|
8
|
-
Location</a>
|
9
|
-
<small class="p-g5-urn">g5-cl-1234-location</small>
|
10
|
-
</h2>
|
11
|
-
|
12
|
-
<h4>Domain</h4>
|
13
|
-
<a class="u-url u-g5-domain" href="http://example.com/">http://example.com/</a>
|
14
|
-
|
15
|
-
<h4>Address</h4>
|
16
|
-
|
17
|
-
<p class="p-adr h-adr">
|
18
|
-
<span class="p-street-address">
|
19
|
-
123 Test Way
|
20
|
-
|
21
|
-
</span>
|
22
|
-
<span class="p-g5-neighborhood">West</span>
|
23
|
-
<span>
|
24
|
-
<span class="p-locality">Testville</span>
|
25
|
-
<span class="p-region">TK</span>
|
26
|
-
<span class="p-postal-code">31324</span>
|
27
|
-
</span>
|
28
|
-
<span class="p-tel">123-123-1234</span>
|
29
|
-
<span class="p-tel p-fax"></span>
|
30
|
-
<span class="u-email">info@salidadelsolapts.com</span>
|
31
|
-
</p>
|
32
|
-
|
33
|
-
<p>
|
34
|
-
<strong>Corporate:</strong>
|
35
|
-
<br/>
|
36
|
-
<span class="p-g5-corporate">true</span>
|
37
|
-
</p>
|
38
|
-
|
39
|
-
<p>
|
40
|
-
<strong>Hours:</strong>
|
41
|
-
<br/>
|
42
|
-
<pre class="p-g5-hour">Mon-Fri: 7am - 6pm, Sat: 8am - 3pm, Sunday: Closed</pre>
|
43
|
-
</p>
|
44
|
-
<p>
|
45
|
-
<strong>Floor Plans:</strong>
|
46
|
-
<br/>
|
47
|
-
<span class="p-g5-floorplan">1, 2, 3, studio apartments</span>
|
48
|
-
</p>
|
49
|
-
|
50
|
-
<p>
|
51
|
-
<strong>Landmarks:</strong>
|
52
|
-
<br/>
|
53
|
-
<span class="p-g5-landmark-1">Venture Marina</span>
|
54
|
-
<br/>
|
55
|
-
<span class="p-g5-landmark-2">River Ridge Golf Course</span>
|
56
|
-
</p>
|
57
|
-
|
58
|
-
<p>
|
59
|
-
<strong>Property Features or Qualifiers:</strong>
|
60
|
-
<br/>
|
61
|
-
<span class="p-g5-aparment-feature-1">Luxury</span>
|
62
|
-
<br/>
|
63
|
-
<span class="p-g5-aparment-feature-2">Gated</span>
|
64
|
-
<br/>
|
65
|
-
<span class="p-g5-aparment-feature-3"></span>
|
66
|
-
</p>
|
67
|
-
|
68
|
-
<p>
|
69
|
-
<strong>Primary Amenities:</strong>
|
70
|
-
<br/>
|
71
|
-
<span class="p-g5-aparment-amenity-1">Stainless Steel Appliances</span>
|
72
|
-
<br/>
|
73
|
-
<span class="p-g5-community-amenity-1">Fitness Center</span>
|
74
|
-
</p>
|
75
|
-
|
76
|
-
<h4>Google Analytics</h4>
|
77
|
-
<dl class="dl-horizontal">
|
78
|
-
<dt>Tracking ID</dt>
|
79
|
-
<dd class="p-ga-tracking-id">UA-1234-1</dd>
|
80
|
-
|
81
|
-
<dt>View Profile ID</dt>
|
82
|
-
<dd class="p-ga-profile-id">ga:1234</dd>
|
83
|
-
</dl>
|
84
|
-
|
85
|
-
<div>
|
86
|
-
<h4>
|
87
|
-
<a href="http://192.168.33.30:3000/locations/g5-cl-6hc1xfr-perry-hertler/integration_settings/1/edit">Integration
|
88
|
-
Settings</a>
|
89
|
-
</h4>
|
90
|
-
<dl class="dl-horizontal">
|
91
|
-
<dt>Inventory Service URL</dt>
|
92
|
-
<dd class="p-g5-inventory-service-url">http://localhost:5777/api/v1/storage_facilities</dd>
|
93
|
-
|
94
|
-
<dt>Inventory Service Auth Token</dt>
|
95
|
-
<dd class="p-g5-inventory-service-auth-token">
|
96
|
-
authtoken
|
97
|
-
</dd>
|
98
|
-
|
99
|
-
<dt>ETL Strategy Name</dt>
|
100
|
-
<dd class="p-g5-etl-strategy-name">EtlStrategies::Centershift4</dd>
|
101
|
-
|
102
|
-
<dt>Inventory Vendor Endpoint</dt>
|
103
|
-
<dd class="p-g5-inventory-vendor-endpoint">https://slc.centershift.com/sandbox40/SWS.asmx?WSDL</dd>
|
104
|
-
|
105
|
-
<dt>Inventory Vendor User Name</dt>
|
106
|
-
<dd class="p-g5-inventory-vendor-user-name">G-5TSite</dd>
|
107
|
-
|
108
|
-
<dt>Inventory Vendor Password</dt>
|
109
|
-
<dd class="p-g5-inventory-vendor-password">1qaz@Wsx</dd>
|
110
|
-
|
111
|
-
<dt>Lead Strategy Name</dt>
|
112
|
-
<dd class="p-g5-lead-strategy-name">LeadStrategies::SiteLink</dd>
|
113
|
-
|
114
|
-
<dt>Lead Vendor Endpoint</dt>
|
115
|
-
<dd class="p-g5-lead-vendor-endpoint">https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL</dd>
|
116
|
-
|
117
|
-
<dt>Lead Vendor User Name</dt>
|
118
|
-
<dd class="p-g5-lead-vendor-user-name">Administrator</dd>
|
119
|
-
|
120
|
-
<dt>Lead Vendor Password</dt>
|
121
|
-
<dd class="p-g5-lead-vendor-password">Demo</dd>
|
122
|
-
|
123
|
-
<dt class=p-g5-custom-integration-setting-name-0>corporate_code</dt>
|
124
|
-
<dd class=p-g5-custom-integration-setting-value-0>1000000129</dd>
|
125
|
-
<dt class=p-g5-custom-integration-setting-name-1>location_code</dt>
|
126
|
-
<dd class=p-g5-custom-integration-setting-value-1>1000000678</dd>
|
127
|
-
<dt class=p-g5-custom-integration-setting-name-2>channel</dt>
|
128
|
-
<dd class=p-g5-custom-integration-setting-value-2>2</dd>
|
129
|
-
</dl>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
|
133
|
-
<dl>
|
134
|
-
<dt>Twitter</dt>
|
135
|
-
<dd class="p-nickname p-g5-nickname-twitter">G5Platform</dd>
|
136
|
-
<dt>Facebook</dt>
|
137
|
-
<dd class="p-nickname p-g5-nickname-facebook">GetG5</dd>
|
138
|
-
<dt>Yelp</dt>
|
139
|
-
<dd class="p-nickname p-g5-nickname-yelp">g5-bend</dd>
|
140
|
-
<dt>Foursquare</dt>
|
141
|
-
<dd class="p-nickname p-g5-nickname-foursquare">
|
142
|
-
https://foursquare.com/v/g5-search-marketing/4b720385f964a5201b6a2de3
|
143
|
-
</dd>
|
144
|
-
</dl>
|
145
|
-
|
146
|
-
<h4>Client</h4>
|
147
|
-
|
148
|
-
<p class="p-org h-card">
|
149
|
-
<a class="p-name u-uid u-url" href="http://example.com/clients/g5-c-1234-client">Test Client</a>
|
150
|
-
</p>
|
151
|
-
</section>
|
152
|
-
|
153
|
-
</body>
|
154
|
-
</html>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe G5FoundationClient::Deserializers::Client do
|
4
|
-
describe ".from_markup" do
|
5
|
-
subject(:client) { G5FoundationClient::Deserializers::Client.from_markup(markup) }
|
6
|
-
|
7
|
-
context "with many fields provided" do
|
8
|
-
let(:markup) { fixture("client_detail.html") }
|
9
|
-
|
10
|
-
its(:uid) { should eq("http://example.com/clients/g5-c-1234-client") }
|
11
|
-
its(:urn) { should eq("g5-c-1234-client") }
|
12
|
-
its(:name) { should eq("Test Client") }
|
13
|
-
its(:vertical) { should eq("Apartments") }
|
14
|
-
its(:domain) { should eq("http://example.com/") }
|
15
|
-
its(:domain_type) { should eq("MultiDomainClient") }
|
16
|
-
|
17
|
-
describe "#locations" do
|
18
|
-
it "instantiates associated Locations" do
|
19
|
-
expect(client.locations.length).to eq(2)
|
20
|
-
expect(client.locations.first.name).to eq("Test Location 1")
|
21
|
-
expect(client.locations.first.uid).to eq("http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "missing many fields" do
|
27
|
-
let(:markup) { fixture("empty_hcard.html") }
|
28
|
-
its(:uid) { should be_nil }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe G5FoundationClient::Deserializers::IntegrationSetting do
|
4
|
-
describe '.from_markup' do
|
5
|
-
subject { G5FoundationClient::Deserializers::Location.from_markup(markup).integration_setting }
|
6
|
-
|
7
|
-
context 'with many fields provided' do
|
8
|
-
let(:markup) { fixture('location_detail.html') }
|
9
|
-
|
10
|
-
its(:inventory_service_url) { should eq('http://localhost:5777/api/v1/storage_facilities') }
|
11
|
-
its(:inventory_service_auth_token) { should eq('authtoken') }
|
12
|
-
its(:etl_strategy_name) { should eq('EtlStrategies::Centershift4') }
|
13
|
-
its(:inventory_vendor_endpoint) { should eq('https://slc.centershift.com/sandbox40/SWS.asmx?WSDL') }
|
14
|
-
its(:inventory_vendor_user_name) { should eq('G-5TSite') }
|
15
|
-
its(:inventory_vendor_password) { should eq('1qaz@Wsx') }
|
16
|
-
its(:lead_strategy_name) { should eq('LeadStrategies::SiteLink') }
|
17
|
-
its(:lead_vendor_endpoint) { should eq('https://www.smdservers.net/CCWs_3.5/CallCenterWs.asmx?WSDL') }
|
18
|
-
its(:lead_vendor_user_name) { should eq('Administrator') }
|
19
|
-
its(:lead_vendor_password) { should eq('Demo') }
|
20
|
-
its(:custom_integration_settings) { should eq({corporate_code: '1000000129', location_code: '1000000678', channel: '2'}) }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe G5FoundationClient::Deserializers::Location do
|
4
|
-
describe ".from_markup" do
|
5
|
-
subject { G5FoundationClient::Deserializers::Location.from_markup(markup) }
|
6
|
-
|
7
|
-
context "with many fields provided" do
|
8
|
-
let(:markup) { fixture("location_detail.html") }
|
9
|
-
|
10
|
-
its(:uid) { should eq("http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location") }
|
11
|
-
its(:urn) { should eq("g5-cl-1234-location") }
|
12
|
-
its(:client_uid) { should eq("http://example.com/clients/g5-c-1234-client") }
|
13
|
-
its(:name) { should eq("Test Location") }
|
14
|
-
its(:phone_number) { should eq("123-123-1234") }
|
15
|
-
its(:domain) { should eq("http://example.com/") }
|
16
|
-
its(:corporate) { should be_true }
|
17
|
-
its(:floor_plans) { should eq("1, 2, 3, studio apartments") }
|
18
|
-
its(:primary_amenity) { should eq("Stainless Steel Appliances") }
|
19
|
-
its(:qualifier) { should eq("Luxury") }
|
20
|
-
its(:primary_landmark) { should eq("Venture Marina") }
|
21
|
-
its(:ga_tracking_id) { should eq("UA-1234-1") }
|
22
|
-
its(:ga_profile_id) { should eq("ga:1234") }
|
23
|
-
its(:neighborhood) { should eq("West") }
|
24
|
-
its(:street_address) { should eq("123 Test Way") }
|
25
|
-
its(:locality) { should eq("Testville") }
|
26
|
-
its(:region) { should eq("TK") }
|
27
|
-
its(:postal_code) { should eq("31324") }
|
28
|
-
end
|
29
|
-
|
30
|
-
context "missing many fields" do
|
31
|
-
let(:markup) { fixture("empty_hcard.html") }
|
32
|
-
its(:uid) { should be_nil }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|