Module: Ravelry::Needles
Overview
Handles API request for the ‘Needles` endpoints. Always returns an array of Needle objects.
Instance Method Summary collapse
-
#list(username) ⇒ Object
Get needle records for an individual user.
-
#sizes(craft = '') ⇒ Object
Get available sizes for each needle type.
-
#types ⇒ Object
Get needle types.
Instance Method Details
#list(username) ⇒ Object
Get needle records for an individual user.
Arguments: username (string, required)
31 32 33 34 |
# File 'lib/ravelry/needles.rb', line 31 def list(username) result = Utils::Request.get("people/#{username}/needles/list.json", :needle_records) result.map { |needle| Needle.new(needle) } end |
#sizes(craft = '') ⇒ Object
Get available sizes for each needle type. If you don’t pass an argument, you’ll get all knitting needle and crochet hook sizes.
If you pass an argument (‘’knitting’‘ or `’crochet’‘), you will only get results that match that type.
Arguments: needle type (string, optional)
14 15 16 17 18 |
# File 'lib/ravelry/needles.rb', line 14 def sizes(craft='') result = Utils::Request .get('needles/sizes.json', :needle_sizes, {:craft => craft}) result.map { |needle| Needle.new(needle) } end |