class IceAndFireApi::House
Attributes
ancestral_weapons[R]
cadet_branches[R]
coat_of_arms[R]
current_lord[R]
died_out[R]
founded[R]
founder[R]
heir[R]
name[R]
overlord[R]
region[R]
seats[R]
sworn_members[R]
titles[R]
url[R]
words[R]
Public Class Methods
find(id)
click to toggle source
# File lib/ice_and_fire_api/house.rb, line 28 def self.find(id) response = Faraday.get("#{IceAndFireApi::API_URL}/houses/#{id}") attributes = JSON.parse(response.body) new(attributes) end
find_by(query_parameters)
click to toggle source
# File lib/ice_and_fire_api/house.rb, line 34 def self.find_by(query_parameters) house_query = URI.encode_www_form(query_parameters) response = Faraday.get("#{IceAndFireApi::API_URL}/houses?#{house_query}") attributes_response = JSON.parse(response.body) attributes_array = [] attributes_response.each do |attributes| attributes_array << new(attributes) end attributes_array end
new(attributes)
click to toggle source
# File lib/ice_and_fire_api/house.rb, line 9 def initialize(attributes) @url = attributes['url'] @name = attributes['name'] @region = attributes['region'] @coat_of_arms = attributes['coatOfArms'] @words = attributes['words'] @titles = attributes['titles'] @seats = attributes['seats'] @current_lord = attributes['currentLord'] @heir = attributes['heir'] @overlord = attributes['overlord'] @founded = attributes['founded'] @founder = attributes['founder'] @died_out = attributes['diedOut'] @ancestral_weapons = attributes['ancestralWeapons'] @cadet_branches = attributes['cadetBranches'] @sworn_members = attributes['swornMembers'] end