-
-
Save sondr3/86f4c0c23703ca4e5898 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
require 'json' | |
file = File.read('data.json') | |
data_hash = JSON.parse(file) | |
data = data_hash['properties'].sort_by{ |e| e['id'].to_i } | |
class Property | |
attr_accessor :id, :group, :colour, :name, :price, :rent, :house_price, :mortage | |
def initialize(params = {}) | |
@id = params[:id] | |
@group = params[:group] | |
@colour = params[:colour] | |
@name = params[:name] | |
@price = params[:price] | |
@rent = params[:rent] | |
@house_price = params[:house_price] | |
@mortage = params[:mortage] | |
end | |
end | |
a = Property.new( | |
id: 1, | |
group: 'property', | |
colour: 'brown', | |
name: 'Parkveien', | |
price: 1200, | |
rent: [40, 200, 600, 1800, 3200, 5000], | |
house_price: 1000, | |
mortage: 600 | |
) |
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
{ | |
"properties": [ | |
{"id": 0, "group": "property","colour": "brown","name": "Parkveien", "price": 1200, "rent": [40, 200, 600, 1800, 3200, 5000], "house_price": 1000, "mortage": 600}, | |
{"id": 1, "group": "property","colour": "brown","name": "Kirkeveien", "price": 1200, "rent": [80, 400, 1200, 3600, 6400, 9000], "house_price": 1000, "mortage": 600}, | |
{"id": 2, "group": "train","colour": "white","name": "Oslo Sentralstasjon", "price": 4000, "rent": [500, 1000, 2000, 4000], "mortage": 2000}, | |
{"id": 3, "group": "property","colour": "blue","name": "Kongens Gate", "price": 2000, "rent": [120, 600, 1800, 5400, 8000, 11000], "house_price": 1000, "mortage": 1000}, | |
{"id": 4, "group": "property","colour": "blue","name": "Prinsens Gate", "price": 2000, "rent": [120, 600, 1800, 5400, 8000, 11000], "house_price": 1000, "mortage": 1000}, | |
{"id": 5, "group": "property","colour": "blue","name": "Øvre Slottsgate", "price": 2400, "rent": [160, 800, 2000, 6000, 9000, 12000], "house_price": 1000, "mortage": 1200}, | |
{"id": 6, "group": "property","colour": "pink","name": "Nedre Slottsgate", "price": 2800, "rent": [200, 1000, 3000, 9000, 12500, 15000], "house_price": 2000, "mortage": 1400}, | |
{"id": 7, "group": "energy","colour": "white","name": "Oslo Lysverk", "price": 3000, "rent": [80, 200], "mortage": 1500}, | |
{"id": 8, "group": "property","colour": "pink","name": "Trondheimsveien", "price": 2800, "rent": [200, 1000, 3000, 9000, 12500, 15000], "house_price": 2000, "mortage": 1400}, | |
{"id": 9, "group": "property","colour": "pink","name": "Nobels Gate", "price": 3200, "rent": [240, 1200, 3600, 10000, 14000, 18000], "house_price": 2000, "mortage": 1600}, | |
{"id": 10, "group": "train","colour": "white","name": "Skøyen Stasjon", "price": 4000, "rent": [500, 1000, 2000, 4000], "mortage": 2000}, | |
{"id": 11, "group": "property","colour": "orange","name": "Grensen", "price": 3600, "rent": [280, 1400, 4000, 11000, 15000, 19000], "house_price": 2000, "mortage": 1800}, | |
{"id": 12, "group": "property","colour": "orange","name": "Gabels Gate", "price": 3600, "rent": [280, 1400, 4000, 11000, 15000, 19000], "house_price": 2000, "mortage": 1800}, | |
{"id": 13, "group": "property","colour": "orange","name": "Ringgata", "price": 4000, "rent": [320, 1600, 4400, 12000, 16000, 20000], "house_price": 2000, "mortage": 2000}, | |
{"id": 14, "group": "property","colour": "red","name": "Bygdøy Alle", "price": 4400, "rent": [360, 1800, 5000, 14000, 17500, 21000], "house_price": 3000, "mortage": 2200}, | |
{"id": 15, "group": "property","colour": "red","name": "Skarpsno", "price": 4000, "rent": [360, 1800, 5000, 14000, 17500, 21000], "house_price": 3000, "mortage": 2200}, | |
{"id": 16, "group": "property","colour": "red","name": "Slemdal", "price": 4800, "rent": [400, 2000, 6000, 15000, 18500, 22000], "house_price": 3000, "mortage": 2400}, | |
{"id": 17, "group": "train","colour": "white","name": "Grorud Stasjon", "price": 4000, "rent": [500, 1000, 2000, 4000], "mortage": 2000}, | |
{"id": 18, "group": "property","colour": "yellow","name": "Karl Johans Gate", "price": 5200, "rent": [440, 2200, 6600, 16000, 19500, 23000], "house_price": 3000, "mortage": 2600}, | |
{"id": 19, "group": "property","colour": "yellow","name": "Stortorget", "price": 5200, "rent": [440, 2200, 6600, 16000, 19500, 23000], "house_price": 3000, "mortage": 2600}, | |
{"id": 20, "group": "energy","colour": "white","name": "Vannverket", "price": 3000, "rent": [80, 200], "mortage": 1500}, | |
{"id": 21, "group": "property","colour": "yellow","name": "Torggata", "price": 5600, "rent": [480, 2400, 7200, 17000, 20500, 24000], "house_price": 3000, "mortage": 2600}, | |
{"id": 22, "group": "property","colour": "green","name": "Trosterudveien", "price": 6000, "rent": [520, 2600, 7800, 18000, 22000, 25500], "house_price": 4000, "mortage": 3000}, | |
{"id": 23, "group": "property","colour": "green","name": "Pilestredet", "price": 6000, "rent": [520, 2600, 7800, 18000, 22000, 25500], "house_price": 4000, "mortage": 3000}, | |
{"id": 24, "group": "property","colour": "green","name": "Sinsen", "price": 6400, "rent": [560, 3000, 9000, 20000, 24000, 280000], "house_price": 4000, "mortage": 3000}, | |
{"id": 25, "group": "train","colour": "white","name": "Bryn Stasjon", "price": 4000, "rent": [500, 1000, 2000, 4000], "mortage": 2000}, | |
{"id": 26, "group": "property","colour": "dark-blue","name": "Ullevål Hageby", "price": 7000, "rent": [700, 3500, 10000, 22000, 26000, 30000], "house_price": 4000, "mortage": 3500}, | |
{"id": 27, "group": "property","colour": "dark-blue","name": "Rådhusplassen", "price": 8000, "rent": [1000, 4000, 12000, 28000, 34000, 40000], "house_price": 4000, "mortage": 4000} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment