class Cubaru::V1::Postcard::Resource
Public Class Methods
new(resource)
click to toggle source
# File lib/cubaru/v1/postcard/resource.rb, line 6 def initialize(resource) @resource = resource end
Public Instance Methods
create(options = {})
click to toggle source
# File lib/cubaru/v1/postcard/resource.rb, line 18 def create(options = {}) if options[:to] && !options[:to].is_a?(String) options[:to] = @resource.format_address_params(options[:to]) end if options[:from] && !options[:from].is_a?(String) options[:from] = @resource.format_address_params(options[:from]) end Cubaru.submit :post, postcard_url, options end
find(postcard_id)
click to toggle source
# File lib/cubaru/v1/postcard/resource.rb, line 14 def find(postcard_id) Cubaru.submit :get, postcard_url(postcard_id) end
list(options={})
click to toggle source
# File lib/cubaru/v1/postcard/resource.rb, line 10 def list(options={}) Cubaru.submit(:get, postcard_url, options)["data"] || [] end
Private Instance Methods
postcard_url(postcard_id = nil)
click to toggle source
# File lib/cubaru/v1/postcard/resource.rb, line 32 def postcard_url(postcard_id = nil) @resource.construct_url("postcards", postcard_id) end