Questions tagged [rails-roar]

Resource-Oriented Architectures in Ruby on Rails.

Resource-Oriented Architectures in Ruby on Rails.

See https://github.com/apotonick/roar-rails

12 questions
3
votes
1 answer

Options grape representer

I am working on a rails API with Representers, using the following gems: Grape, Roar and Grape-Roar Now, I try to add conditions to include (or not include) certain properties in my representer based on a condition I pass from my API endpoint as…
PSR
  • 513
  • 6
  • 16
3
votes
2 answers

How to dynamically add properties to a ROAR representer?

I am using ROAR to implement an API for a rails application. This application deals with tickets that can have attributes like a subject and a description, but also have user defined attributes. For simplicity lets assume a ticket looks like: class…
NobodysNightmare
  • 2,992
  • 2
  • 22
  • 33
3
votes
1 answer

ROAR: What are the benefits over jbuilder or rabl?

I've read through https://github.com/apotonick/roar and it seems like a lot of thought has been put into ROAR. But in the context of a fairly standard Rails-powered JSON API that uses jbuilder, I'm still not able to immediately see what benefits…
ktusznio
  • 3,585
  • 3
  • 22
  • 21
2
votes
1 answer

respond_with having issue with Rails 5

I am upgrading my Rails app from 4.1.1 to 5.1.4. I am using roar-rails gem to parsing and rendering REST documents. I am facing some issues as responders gem has been extracted to separate gem. respond_with has been moved to 'responders' gem. My…
2
votes
1 answer

How to filter properties/collections out from representers?

For example, I have a representer looking like: module AccountRepresenter include Roar::Representer::JSON include Roar::Representer::Feature::Hypermedia property :id property :name collection :assets, :extend => AssetRepresenter, :class…
Lai Yu-Hsuan
  • 27,509
  • 28
  • 97
  • 164
2
votes
0 answers

Consuming models from an API in multiple rails apps

I'm in the process of setting up a centralised data management system + CAS for a series of apps that currently have duplicated data across many databases that is a nightmare to manage. I've got the CAS system implemented nicely with rubycas-server…
Chelsea
  • 6,751
  • 5
  • 29
  • 31
1
vote
3 answers

Consuming REST API Rails

I've looked at this question but it's quite old and I feel there's now other alternatives to ARes. Given that many people seem to think that ActiveResource is kind of outdated and heavyweight, I've looked at Api Smith, Her, Roar and of course ARes.…
Yeggeps
  • 2,055
  • 2
  • 25
  • 34
0
votes
1 answer

How to render plain XML properties with Roar::Decorator

I am trying to render a plain XML output within a Roar::Decorator. For some reason it is not possible to get unescaped output. I have this class: class GetShopProductsRequest < OpenStruct def data_filter xml_s = [] xml_s << "" …
Florian Eck
  • 495
  • 3
  • 13
0
votes
1 answer

Strategy to create multiple representations for the same class based on criteria using ROAR gem?

This is actually a best practices / usage question on hwo to use Roar & representable in Rails, as I didn't find any examples of that. Here are two scenarios. I use decorator pattern. Scenario 1: Let's say I have a Product class that has multiple…
konung
  • 6,908
  • 6
  • 54
  • 79
0
votes
1 answer

NameError: uninitialized constant Roar::JSON in Sinatra

I'm building an app in Ruby/Sinatra where I want to use Roar for JSON (and Hal) output. At the moment I'm having problems with Roar. These gems are installed: Using i18n 0.6.11 Using json 1.8.1 Using minitest 5.4.2 Using thread_safe 0.3.4 Using…
LiveNL
  • 194
  • 2
  • 15
0
votes
1 answer

How can I stop Grape from JSON-encoding my output twice?

I'm currently implementing a JSON based Grape API. I've integrated roar for JSON serailization and deserialization. When executing the following code, it seems that the JSON is encoded twice resulting a response with slashes. Is there anyway on…
Jani
  • 1,400
  • 17
  • 36
-1
votes
1 answer

Creating a collection of nested resources in roar-rails

I am trying to create new objects with a collection of nested resources. When I POST my json, I get: ActiveRecord::AssociationTypeMismatch: FormLabel(#70306552439440) expected, got Hash(#70306480154920) Here's my code: # form.rb class Form <…
Simon Woodside
  • 7,175
  • 5
  • 50
  • 66