Class: Alula::M2MRestResource

Inherits:
ApiResource show all
Defined in:
lib/alula/m2m_rest_resource.rb

Direct Known Subclasses

M2MCentralStation

Instance Attribute Summary

Attributes inherited from ApiResource

#dirty_attributes, #errors, #id, #link_matchers, #links, #rate_limit, #raw_data, #values

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiResource

#annotate_errors, #apply_attributes, #as_json, #as_patchable_json, build, #cache_links, class_name, #clone, #construct_from, #dirty?, #errors?, #filter_builder, #initialize, #model_name, #reconstruct_from, #refresh

Constructor Details

This class inherits a constructor from Alula::ApiResource

Class Method Details

.resource_url(id = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/alula/m2m_rest_resource.rb', line 3

def self.resource_url(id = nil)
  if self == M2MRestResource
    raise NotImplementedError, "Cannot call resource_url on a M2MRestResource. Try using M2MCentralStation instead."
  end
  base_path = "/m2m/bll/v3/external"
  return base_path if id.nil?

  [base_path, id].join('/').gsub(%r{/+}, '/').sub(%r{/$}, '')
end

Instance Method Details

#resource_url(id = nil) ⇒ Object



13
14
15
# File 'lib/alula/m2m_rest_resource.rb', line 13

def resource_url(id = nil)
  self.class.resource_url(id)
end