module Place
Constants
- VERSION
Attributes
PROD_URL[RW]
TEST_URL[RW]
api_key[RW]
api_url[RW]
default_client[RW]
Public Class Methods
conv_object(obj, client: nil, inverse: false)
click to toggle source
# File lib/place/api_resource.rb, line 17 def self.conv_object(obj, client: nil, inverse: false) obj = obj.clone if obj.class == Array iter = obj.map.with_index{|a,i| [i,a] } else iter = obj end iter.each do |key, val| if inverse if val.is_a?(Place::APIResource) obj[key] = val._obj val = obj[key] end elsif val.is_a?(Hash) and val['object'] for resource in Place::APIResource.descendants if val['object'] != resource.object_type next end obj[key] = resource.new(client: client, obj: val) val = obj[key] break end end if [Hash, Array].member? val.class obj[key] = Place::conv_object(val, client:client, inverse: inverse) end end return obj end
merge_obj( obj: nil, **params )
click to toggle source
# File lib/place/api_resource.rb, line 7 def self.merge_obj( obj: nil, **params ) params = params.collect{|k,v| [k.to_s, v]}.to_h if obj obj = obj.merge(params) else obj = params end return obj end