Module: CollectionJSON
- Defined in:
- lib/collection-json.rb,
lib/collection-json/builder.rb,
lib/collection-json/goliath.rb,
lib/collection-json/version.rb,
lib/collection-json/attribute.rb,
lib/collection-json/attributes/data.rb,
lib/collection-json/attributes/item.rb,
lib/collection-json/attributes/link.rb,
lib/collection-json/attributes/error.rb,
lib/collection-json/attributes/query.rb,
lib/collection-json/transformers/uri.rb,
lib/collection-json/attributes/template.rb,
lib/collection-json/attributes/collection.rb
Defined Under Namespace
Modules: Goliath
Classes: Attribute, Builder, Collection, Data, Error, Item, ItemBuilder, Link, Query, QueryBuilder, Template, TemplateBuilder, URI
Constant Summary
collapse
- VERSION =
"0.1.7"
Class Method Summary
collapse
Class Method Details
.generate_for(href, &block) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/collection-json.rb', line 10
def self.generate_for(href, &block)
Collection.new.tap do |response|
response.href href
if block_given?
builder = Builder.new(response)
yield(builder)
end
end
end
|
.parse(json) ⇒ Object
20
21
22
23
|
# File 'lib/collection-json.rb', line 20
def self.parse(json)
hash = JSON.parse(json)
collection = Collection.from_hash(hash[ROOT_NODE])
end
|