Releases: prismicio-community/ruby-kit
1.0.0.rc7
1.0.0.rc6
This release introduces a caching mechanism, but contains a minor bug; please upgrade to 1.0.0.rc7 instead.
New feature
- Basic and overridable caching system: the
Prismic::Api
constructor takes an extra optionalcache
parameter, which takes an object to use as the cache. The kit also comes with a newPrismic::Cache
class, and aDefaultCache
object of that class, that is being used out-of-the-box.- How to enable the basic out-of-the-box cache? --> It is already enabled. If you're using an earlier version of the kit, just upgrade to this one, and the cache will be up and running.
- How to disable the cache? --> pass
false
as the value of thecache
parameter when you initialize yourPrismic::Api
object. - How to make my own cache? --> extend
Prismic::Cache
with your own class, change all the methods you need to change (probably most of them, but there aren't that many), instantiate an object of that class, and pass it as thecache
parameter of yourPrismic::Api
instantiation.
Bugfix
- Embed blocks in a structured text fragment were oddly unmarshalled as a
Prismic::Fragments::StructuredText::Block::Image
object which contained aPrismic::Fragments::Embed
object. They are now unmarshalled directly as aPrismic::Fragments::Embed
. Note: if you hadn't overridden it, the HTML serialization of structured text fragments (even those containing embeds) already worked and is unchanged.
1.0.0.rc5
1.0.0.rc4
Fix
- Support OAuth signin for private repositories (a39b8f0 in #32)
- The OAuth's token checking now uses the provided HTTPClient (fd21413 in #32)
Potentially breaking changes
Prismic::API#oauth_initiate_url
andPrismic::API#oauth_check_token
are now deprecated. Please usePrismic.oauth_initiate_url
andPrismic.oauth_check_token
instead
1.0.0.rc3
New feature
- Pagination specifics are now exposed. This means now you still get your results paginated 20 by 20, but for each API call you also get the total number of pages, the total amount of results, the page number you're on, etc... which makes it trivial for you to build a pagination.
Potentially breaking changes
The object returned by submit
calls (let's call it @documents
) is no longer an Array, but an Enumerable. This is so that it can now also expose the new pagination specifics (@documents.total_results_size
, @documents.total_pages
, etc)
If you were doing those things with this object, it will still work (we reimplemented them):
@documents[i]
withi
an integer@documents[i].length
or@documents[i].size
(which return the same thing)@documents[i].each
,@documents[i].map
,@documents[i].join
, ... anything in the Enumerable mixin
However, if you were using Array-specific methods that are not part of Enumerable (@documents.empty?
, @documents.rotate
, ...), you will need to change it into: @documents.results.empty?
, @documents.results.rotate
, ...
If you are using an MVC framework such as Rails, note that the call to submit
should be executed in your controller, but the use of the returned variable (which you may have to fix) may happen in your view.
1.0.0.rc2
Fixes
- Links's
url
methods now have a consistent interface (link_resolver
is no more mandatory when it's optional—as in WebLink), better error message (whenlink_resolver
is mandatory and missing) and are now documented - HTML serialization of spans (through the
as_html
method) produced output that forgot to close spans, like this:<p><strong>Lorem ipsum</p>
. Now fixed, produces<p><strong>Lorem ipsum</strong></p>
.
1.0.0.rc1
Potentially breaking changes for advanced users
- If you've been monkey-patching or overriding the
Prismic::Fragments::MediaLink
class: it doesn't exist anymore, and is now replaced byPrismic::Fragments::FileLink
orPrismic::Fragments::ImageLink
, depending on the kind of link.
New features
- Support for
Link.image
andLink.file
kinds of links, with newPrismic::Fragments::FileLink
andPrismic::Fragments::ImageLink
classes. Prismic::Fragments::Group
class now includesEnumerable
, which means you can useeach
,map
,select
, etc. onGroup
objects. Same withPrismic::Fragments::Group::FragmentMapping
objects (used internally by theGroup
class).Prismic::Fragments::Group
class now have alength
method, aliased assize
. Same withPrismic::Fragments::Group::FragmentMapping
objects (used internally by theGroup
class).- The
url
method only existed for thePrismic::Fragments::WebLink
class, now it is directly in thePrismic::Fragments::Link
class, extended by all links classes:Prismic::Fragments::WebLink
,Prismic::Fragments::DocumentLink
, etc...
Syntactic sugar
- Since you can now call
url
on any kind of link (see right above), this allows to do this in Rails, regardless of the kind of link thelink
object is:<%= link_to "Click here", link.url, :whatever_attribute => "whatever value" %>
.
1.0.0.preview.8
New features
- Support for group fragments.
- Support for unknown fragments (instead of crashing, ignores the fragment with a warning advising to update the kit).
Syntactic sugar
Prismic::API#create_search_form
is nowPrismic::API#form
(the former issues a deprecation warning, and will be removed in a later release); the online cross-tech doc was adapted to reflect that possibility.
1.0.0.preview.7
Potentially breaking changes for basic users
- Boldness in
Prismic::Fragments::StructuredText#as_html
was represented as<b>
tags, now as<strong>
tags.
New features
- You had to call
Prismic::Link_resolver#link_to
on aPrismic::Fragments::DocumentLink
object, but sometimes, you actually have the fullPrismic::Document
; you can now call it on both types of objects. - You had to call
api.master_ref
to get the master ref; now you can call itapi.master
, just like in the other dev kits; both methods do the same thing. - New method:
Prismic::Fragments::StructuredText#as_text
, renders zero formatting, and ignores images and embeds. Prismic::SearchForm
only had thequery
method to set theq
parameter of the API call. Now those methods are dynamically created from the RESTful form found in the/api
document, so it's now possible to use those methods too:orderings
,page
,pageSize
, as well as all the future non-yet-existing ones.
1.0.0.preview.6
Potentially breaking changes for basic users
- From an image, you had to call the view with its index, like this
image_object[0]
; now they're stored in a Hash, you have to call them with their proper name:image_object['large']
.