module Brickset::Api::Set
Public Instance Methods
additional_images(set_id)
click to toggle source
# File lib/brickset/api/set.rb, line 83 def additional_images(set_id) self.set_id = set_id if valid?(:additional_images) xml = call('/getAdditionalImages', setID: set_id) Brickset::Elements::AdditionalImage.parse(xml) else raise ValidationError, self.errors.full_messages.to_sentence end end
instructions(set_id)
click to toggle source
# File lib/brickset/api/set.rb, line 105 def instructions(set_id) self.set_id = set_id if valid?(:instructions) xml = call('/getInstructions', setID: set_id) Brickset::Elements::Instruction.parse(xml) else raise ValidationError, self.errors.full_messages.to_sentence end end
recently_updated_sets(minutes_ago)
click to toggle source
# File lib/brickset/api/set.rb, line 72 def recently_updated_sets(minutes_ago) self.minutes_ago = minutes_ago if valid?(:recently_updated_sets) xml = call('/getRecentlyUpdatedSets', minutesAgo: minutes_ago) Brickset::Elements::Set.parse(xml) else raise ValidationError, self.errors.full_messages.to_sentence end end
reviews(set_id)
click to toggle source
# File lib/brickset/api/set.rb, line 94 def reviews(set_id) self.set_id = set_id if valid?(:reviews) xml = call('/getReviews', setID: set_id) Brickset::Elements::Review.parse(xml) else raise ValidationError, self.errors.full_messages.to_sentence end end
set(set_id)
click to toggle source
# File lib/brickset/api/set.rb, line 61 def set(set_id) self.set_id = set_id if valid?(:set) xml = call('/getSet', setID: set_id) Brickset::Elements::Set.parse(xml, single: true) else raise ValidationError, self.errors.full_messages.to_sentence end end
sets(query: '', theme: '', subtheme: '', set_number: '', year: '', owned: '', wanted: '', order_by: 'number', page_size: 20, page_number: 1, username: '', order_direction: Order::Direction::ASC)
click to toggle source
# File lib/brickset/api/set.rb, line 45 def sets(query: '', theme: '', subtheme: '', set_number: '', year: '', owned: '', wanted: '', order_by: 'number', page_size: 20, page_number: 1, username: '', order_direction: Order::Direction::ASC) self.set_number = set_number self.page_size = page_size self.page_number = page_number self.order_by = order_by self.order_direction = order_direction if valid?(:sets) # NOTE: all of the parameters are required, even though the API specifies them as optional. xml = call('/getSets', query: query, theme: theme, subtheme: subtheme, setNumber: set_number, year: year, owned: owned, wanted: wanted, orderBy: order, pageSize: page_size, pageNumber: page_number, userName: username) Brickset::Elements::Set.parse(xml) else raise ValidationError, self.errors.full_messages.to_sentence end end
subthemes(theme)
click to toggle source
# File lib/brickset/api/set.rb, line 121 def subthemes(theme) xml = call('/getSubthemes', theme: theme) Brickset::Elements::Subtheme.parse(xml) end
subthemes_for_user(theme, owned: '', wanted: '')
click to toggle source
# File lib/brickset/api/set.rb, line 136 def subthemes_for_user(theme, owned: '', wanted: '') xml = call('/getSubthemesForUser', theme: theme, owned: owned, wanted: wanted) Brickset::Elements::Subtheme.parse(xml) end
themes()
click to toggle source
# File lib/brickset/api/set.rb, line 116 def themes xml = call('/getThemes') Brickset::Elements::Theme.parse(xml) end
themes_for_user(owned: '', wanted: '')
click to toggle source
# File lib/brickset/api/set.rb, line 131 def themes_for_user(owned: '', wanted: '') xml = call('/getThemesForUser', owned: owned, wanted: wanted) Brickset::Elements::Theme.parse(xml) end
years(theme)
click to toggle source
# File lib/brickset/api/set.rb, line 126 def years(theme) xml = call('/getYears', theme: theme) Brickset::Elements::Year.parse(xml) end
years_for_user(theme, owned: '', wanted: '')
click to toggle source
# File lib/brickset/api/set.rb, line 141 def years_for_user(theme, owned: '', wanted: '') xml = call('/getYearsForUser', theme: theme, owned: owned, wanted: wanted) Brickset::Elements::Year.parse(xml) end
Private Instance Methods
order()
click to toggle source
# File lib/brickset/api/set.rb, line 148 def order if order_direction == Order::Direction::DESC [ order_by, order_direction.upcase ].join else order_by end end