Module: Brickset::Api::Set
Defined Under Namespace
Modules: Order
Instance Method Summary collapse
- #additional_images(set_id) ⇒ Object
- #instructions(set_id) ⇒ Object
- #recently_updated_sets(minutes_ago) ⇒ Object
- #reviews(set_id) ⇒ Object
- #set(set_id) ⇒ Object
- #sets(query: '', theme: '', subtheme: '', set_number: '', year: '', owned: '', wanted: '', order_by: 'number', page_size: 20, page_number: 1, username: '', order_direction: Order::Direction::ASC) ⇒ Object
- #subthemes(theme) ⇒ Object
- #subthemes_for_user(theme, owned: '', wanted: '') ⇒ Object
- #themes ⇒ Object
- #themes_for_user(owned: '', wanted: '') ⇒ Object
- #years(theme) ⇒ Object
- #years_for_user(theme, owned: '', wanted: '') ⇒ Object
Instance Method Details
#additional_images(set_id) ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# 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..to_sentence end end |
#instructions(set_id) ⇒ Object
105 106 107 108 109 110 111 112 113 114 |
# 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..to_sentence end end |
#recently_updated_sets(minutes_ago) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# 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..to_sentence end end |
#reviews(set_id) ⇒ Object
94 95 96 97 98 99 100 101 102 103 |
# 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..to_sentence end end |
#set(set_id) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# 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..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) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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..to_sentence end end |
#subthemes(theme) ⇒ Object
121 122 123 124 |
# 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: '') ⇒ Object
136 137 138 139 |
# 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 ⇒ Object
116 117 118 119 |
# File 'lib/brickset/api/set.rb', line 116 def themes xml = call('/getThemes') Brickset::Elements::Theme.parse(xml) end |
#themes_for_user(owned: '', wanted: '') ⇒ Object
131 132 133 134 |
# 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 |