Created
August 10, 2013 08:37
-
-
Save pjc/6199616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FACTUAL_KEY = #omitted | |
FACTUAL_SECRET_KEY = #omitted | |
LOB_TEST_API_KEY = #omitted | |
require 'factual' | |
require 'lob' | |
factual = Factual.new(FACTUAL_KEY, FACTUAL_SECRET_KEY) | |
hotels = factual.table("hotels-us").limit(20).rows | |
Lob.api_key = LOB_TEST_API_KEY | |
@lob = Lob() | |
hotels.each do |hotel| | |
@lob.addresses.create( | |
name: hotel['name'], | |
address_line1: hotel['address'], | |
city: hotel['locality'], | |
state: hotel['region'], | |
country: 'US', | |
zip: hotel['postcode'].to_i | |
) | |
puts "Hotel #{hotel["name"]} has been created at Lob." | |
end | |
puts | |
puts "Here is the list of addresses from Lob:" | |
puts @lob.addresses.list | |
# puts "Hotel #{i+1} has the following info:" | |
# puts "Name is: #{hotel['name']}" | |
# puts "Address line 1 (address) is: #{hotel['address']}" | |
# puts "City (locality) is: #{hotel['locality']}" | |
# puts "State (region) is: #{hotel['region']}" | |
# puts "Zip (postcode) is: #{hotel['postcode']}" | |
# puts "=" * 75 | |
# gem 'httparty' | |
# response = HTTParty.get('http://api.v3.factual.com/t/hotes-us/schema') | |
# puts response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment