lhs
lhs copied to clipboard
⚛️ REST services accelerator: Rails gem providing an easy, active-record-like interface for http (hypermedia) json services
Usefull in inheritance scenario. e.g.: ``` ruby class Base < LHS::Record endpoint 'records/:id' endpoint 'records/:type' end class Example < Base default_params type: 'examples' end # get records/examples ```
Example: ``` ruby => "http://datastore/v2/places/123"}> [11] pry(main)> sub_ressource_place.load! ETHON: performed EASY effective_url=http://datastore/v2/places/123 response_code=401 return_code=ok total_time=0.015113 LHC::Unauthorized: get http://datastore/v2/places/123 Params: {:url=>"http://datastore/v2/places/123", :method=>:get} Headers: {"User-Agent"=>"Typhoeus - https://github.com/typhoeus/typhoeus"} Response Code: 401 {"error":"unauthorized","error_description":"An Authentication...
http://guides.rubyonrails.org/active_record_querying.html#applying-a-default-scope
Right now chaining options on items is not possible, but sometimes it would be nice to have: ``` ruby records = Record.where(color: 'blue') item = records.first.users.first item.options(headers: { "T-ID" =>...
to_h
Add `to_h` and `to_hash` method `Record` and `Data`. As requested by @Averethel recently
When rails is running and LHS::Record classes are changed, the change does not get automatically reloaded.
`responds_to_missing?` is used multiple times here, but never really tested. We should especially test those case, because they can become extraordinary nasty.
@gonzalocasas > Multiple sort criteria. For example, if you want to specify sort by name and then by creation_date, the hash is not order-preserving, so you cannot know which sorting...
_Reproduce_ 1.) Use `.all` in controller to return all items. ``` ruby # example def index @callcenters = Spamnumber.callcenters end ``` 2.) Now render those items as json to provide...
Following should return `{ items: 666 }` instead of `666`. ``` ruby context 'non collection object with key items' do let(:collection) do LHS::Data.new(items: 666) end it 'converts with options to...