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
require 'httparty' | |
doc = HTTParty.get("http://redsky.target.com/v2/pdp/tcin/52029895?excludes=taxonomy") | |
puts "1.URL --> #{doc["product"]["item"]["buy_url"]}" | |
puts "2.Title --> #{doc["product"]["item"]["product_description"]["title"]}" | |
puts "3.Details --> #{doc["product"]["item"]["product_description"]["downstream_description"]}" | |
puts "4.Description --> #{doc["product"]["item"]["product_description"]["bullet_description"]}" | |
#puts "5. #{doc["product"]["item"]["product_description"]["soft_bullets"]["title"]}--->#{doc["product"]["item"]["product_description"]["soft_bullets"]["bullets"]}" | |
puts "6.Price --> #{doc["product"]["price"]["offerPrice"]["formattedPrice"]}" | |
puts "7.Rating-Count --> #{doc["product"]["rating_and_review_statistics"]["result"]["52029895"]["coreStats"]["TotalReviewCount"]}" | |
puts "8.Rating --> #{doc["product"]["rating_and_review_statistics"]["result"]["52029895"]["coreStats"]["AverageOverallRating"]}" |
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
require 'httparty' | |
doc = HTTParty.get("http://redsky.target.com/v2/pdp/tcin/52029893?excludes=taxonomy") | |
puts "1.URL --> #{doc["product"]["item"]["buy_url"]}" | |
puts "2.Title --> #{doc["product"]["item"]["product_description"]["title"]}" | |
puts "3.Details --> #{doc["product"]["item"]["product_description"]["downstream_description"]}" | |
puts "4.Description --> #{doc["product"]["item"]["product_description"]["bullet_description"]}" | |
#puts "5. #{doc["product"]["item"]["product_description"]["soft_bullets"]["title"]}--->#{doc["product"]["item"]["product_description"]["soft_bullets"]["bullets"]}" | |
puts "6.Price --> #{doc["product"]["price"]["offerPrice"]["formattedPrice"]}" | |
puts "7.Rating-Count --> #{doc["product"]["rating_and_review_statistics"]["result"]["52029893"]["coreStats"]["TotalReviewCount"]}" | |
puts "8.Rating --> #{doc["product"]["rating_and_review_statistics"]["result"]["52029893"]["coreStats"]["AverageOverallRating"]}" |
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
require 'httparty' | |
product = {} | |
=begin | |
puts "Enter URL" | |
url= gets .chomp | |
doc = HTTParty.get("#{url}") | |
=end | |
doc = HTTParty.get("http://redsky.target.com/v2/pdp/tcin/52029895?excludes=taxonomy") | |
product["URL"] = doc["product"]["item"]["buy_url"] | |
product["Title"] = doc["product"]["item"]["product_description"]["title"] |
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
require 'mongo' | |
require 'httparty' | |
mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') | |
collection = mongo[:ProductDetails] | |
def store | |
product_details = {} | |
doc = HTTParty.get("http://redsky.target.com/v2/pdp/tcin/52029895?excludes=taxonomy") | |
product_details["URL"] = doc["product"]["item"]["buy_url"] | |
product_details["Title"] = doc["product"]["item"]["product_description"]["title"] | |
product_details["Details"] = doc["product"]["item"]["product_description"]["downstream_description"] |
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
#class Product | |
require 'mongo' | |
require 'httparty' | |
mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') | |
collection = mongo[:Product] | |
#def store | |
product_details = { | |
doc: 'HTTParty.get("http://redsky.target.com/v2/pdp/tcin/52029895?excludes=taxonomy")', | |
'product_details["URL"]': 'doc["product"]["item"]["buy_url"]', | |
'product_details["Title"]': 'doc["product"]["item"]["product_description"]["title"]', |
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
class Product | |
require 'mongo' | |
require 'httparty' | |
def initialize | |
@product_details = {} | |
@mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') | |
@collection = @mongo[:Product2] | |
end | |
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
require 'mongo' | |
require 'httparty' | |
class Product | |
attr_accessor :host | |
def initialize(host) | |
@product_details = {} | |
@host = host | |
@doc = HTTParty.get(host) | |
@mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') |
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
require 'mongo' | |
require 'httparty' | |
class Product | |
attr_accessor :url | |
def initialize(url) | |
@product_details = {} | |
@url = url | |
@doc = HTTParty.get(url) | |
@mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') |
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
require 'mongo' | |
require 'httparty' | |
require 'logger' | |
class Product | |
attr_accessor :url | |
def initialize(url) | |
@product_details = {} | |
@mongo = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'test') | |
@logger = Logger.new(STDOUT) |
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
require 'httparty15' | |
describe Product do | |
it "gives product details" do #actuall test | |
#skip | |
url = "http://redsky.target.com/v2/pdp/tcin/52029745?excludes=taxonomy" | |
product = Product.new(url) | |
product_details = product.product_details | |
expect(product_details["Title"]).to include "Alligator" | |
#expect(product_details).to include "URL" | |
end |
OlderNewer