Class: Typekit::Library
- Inherits:
-
Object
- Object
- Typekit::Library
- Includes:
- MassAssignment
- Defined in:
- lib/typekit/library.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.all ⇒ Object
Gets a list of all the Typekit libraries.
-
.find(id, params = {}) ⇒ Array
Gets a paginated list of families available in the specified library.
Methods included from MassAssignment
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/typekit/library.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/typekit/library.rb', line 4 def name @name end |
Class Method Details
.all ⇒ Object
Gets a list of all the Typekit libraries
10 11 12 13 14 |
# File 'lib/typekit/library.rb', line 10 def all Client.get('/libraries').inject([]) do |libraries, attributes| libraries << Library.new(attributes) end end |
.find(id, params = {}) ⇒ Array
Gets a paginated list of families available in the specified library
20 21 22 23 24 25 26 |
# File 'lib/typekit/library.rb', line 20 def find(id, params = {}) { :page => 1, :per_page => 20 }.merge!(params) library = Client.get("/libraries/#{id}", :query => params) library['families'].inject([]) do |families, attributes| families << Family.new(attributes) end end |