Questions tagged [activeresource]

ActiveResource is the main class for mapping RESTful resources as models in a Rails application

Active Resource objects represent your RESTful resources as manipulatable Ruby objects. To map resources to Ruby objects, Active Resource only needs a class name that corresponds to the resource name (e.g., the class Person maps to the resources people, very similarly to Active Record) and a site value, which holds the URI of the resources.

355 questions
0
votes
0 answers

Shopify api returns nothing when there really is data

Using the Python shopify API, I create a session and try to fetch all orders for a store. The code looks like this: import shopify import pprint import logging logger=logging.getLogger(__name__) shopify.Session.setup(api_key=api_key,…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
0
votes
0 answers

Is it possible to do a transaction with active resource?

Looking through the activeresource gem I couldn't find any code to handle transactions, similar to a normal activerecord transaction, which rolls back any changes when an error occurs. Has anybody implemented a transaction on activeresource?
Justin Tanner
  • 14,062
  • 17
  • 82
  • 103
0
votes
1 answer

Ruby on Rails Show Nested ActiveResources

I have an app which connects to a REST rails app. I have two resources: category and post; post is nested in category. I was able to successfully CRUD categories. I am only able to list posts but no success in showing or updating. Here is my sample…
vald
  • 35
  • 3
0
votes
1 answer

API endpoint link is working in Postman but not in Ruby on Rails with ActiveResource

I am working on Ruby on Rails application which requires to access an External API via GET requests. The request needs to send some parameters with request. I have used Activeresource gem for accessing API. The API request is working fine in Postman…
cvibha
  • 693
  • 5
  • 9
0
votes
0 answers

Send body with type x-www-form-urlencoded, in Active resource

Using Active Resource I have to send the authentication with the type x-www-form-urlencoded, however it is sending it with the json format: In my model base self.site = 'http://url.ngrok.io/api' En rails console login =…
0
votes
1 answer

Filtering Active Resource Objects Using Where Clause

I am looking to build a basic Shopify app using Ruby on Rails. I am using the Shopify_app gem to faciliate my API calls to Shopify. For example orders = ShopifyAPI::Order.find(:all, :params => {:limit => 3}) I am really struggling with how to…
0
votes
1 answer

ApiAuth gem + ActiveResource

I'm trying to get ApiAuth working with ActiveResource and having no luck. The documentation suggests this as the way to use the gem: class Foo < ActiveResource::Base with_api_auth("foo", "bar") end This results in the following…
jaydel
  • 14,389
  • 14
  • 62
  • 98
0
votes
1 answer

One Rails model with two database choices, chosen on instantiation

My Rails app (let's call it "Mira") will be interfacing with an existing app (let's call it "Jira"). Mira will store information about Jira and will be able to directly manipulate its database (because Jira, we'll say, has an incomplete API). Since…
chadoh
  • 4,343
  • 6
  • 39
  • 64
0
votes
2 answers

Rename ActiveResource properties

I am consuming JSON data from a third party API, doing a little bit of processing on that data and then sending the models to the client as JSON. The keys for the incoming data are not named very well. Some of them are acronyms, some just seem to be…
Brad
  • 5,428
  • 1
  • 33
  • 56
0
votes
2 answers

Convert custom API to Ruby on Rails ActiveResource

I have a set of embedded devices that run software written in c++. The API to communicate the devices is simple: get/set/acquire parameters and signals. I'd like to implement common web application to access all of the devices from a single…
matejk
  • 798
  • 1
  • 14
  • 27
0
votes
1 answer

Where to start the Authentication request for Active Resource when working with OAuth

I am having trouble connecting a few dots with OAuth and Active Resource. Here is what I know: The Active Resource documentation tells me that I can set authentication tokens on the ActiveResource model itself like…
Colin Brogan
  • 728
  • 10
  • 26
0
votes
1 answer

How do I make two different ActiveResource models use two different connection objects?

Turns out the connection between ActiveResource models is shared. So if you set the format in one model, it does stay different from the format in other models. However, if you call the .connection.format method on two separate models, that format…
nzifnab
  • 15,876
  • 3
  • 50
  • 65
0
votes
2 answers

Conditional 'attr_accessible' using ActiveResource in Ruby on Rails

I have two RoR3 application: http://users.domain.local http://profiles.domain.local I created the 'users/models/profile.rb': class Profile < ActiveResource::Base self.site = "http://profiles.domain.local" end In 'profiles/models/profile.rb' I…
user502052
  • 14,803
  • 30
  • 109
  • 188
0
votes
1 answer

Consume Rails web service through a Rails application

There seem to be a few alternatives for Rails web services. Namely ActiveResource, HTTParty and Nokogiri Is there a clear winner between these 3 (or others) for getting the job done? The requirements are basic i.e. do a POST without requiring any…
Dimitris
  • 2,501
  • 3
  • 21
  • 28
0
votes
1 answer

ActiveResource NameError in Overridden Devise class

I'm attempting to use an ActiveResource class (Staff) within an overridden Devise resource (User). The purpose at this time is simply to return a list of Staff for the registering user to select from at registration time.…
Mark
  • 23
  • 3