Class: Alula::M2MCentralStation
- Inherits:
-
M2MRestResource
- Object
- ApiResource
- M2MRestResource
- Alula::M2MCentralStation
- Extended by:
- ResourceAttributes
- Defined in:
- lib/alula/resources/m2m/m2m_central_station.rb
Constant Summary collapse
- DEFAULT_PAGE_NUMBER =
1
Instance Attribute Summary
Attributes inherited from ApiResource
#dirty_attributes, #errors, #id, #link_matchers, #links, #rate_limit, #raw_data, #values
Class Method Summary collapse
- .list(filters = {}, opts = {}) ⇒ Object
- .method_missing(method, *args, &block) ⇒ Object
- .respond_to_missing?(method, include_private = false) ⇒ Boolean
- .retrieve(id) ⇒ Object
Methods included from ResourceAttributes
date_fields, extended, field, field_names, filterable_fields, get_fields, get_http_methods, get_resource_path, get_type, http_methods, param_key, read_only_attributes, resource_path, sortable_fields, type
Methods inherited from M2MRestResource
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
.list(filters = {}, opts = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/alula/resources/m2m/m2m_central_station.rb', line 33 def list(filters = {}, opts = {}) built_filters = {} pagination = filters.delete(:page) if pagination built_filters['Page'] = pagination[:number] built_filters['PageSize'] = pagination[:size] end response = Alula::Client.request(:post, resource_url('GetAvailableCentralStations'), built_filters, opts) if response.ok? list = construct_list_from_response(self, response.data.fetch('ResponseBody', {}), pagination) list.rate_limit = response.rate_limit list else error_class = M2MError.for_response(response) raise error_class end end |
.method_missing(method, *args, &block) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/alula/resources/m2m/m2m_central_station.rb', line 65 def method_missing(method, *args, &block) query = QueryInterface.new(self) return query.public_send(method, *args, &block) if query.respond_to?(method) super end |
.respond_to_missing?(method, include_private = false) ⇒ Boolean
72 73 74 |
# File 'lib/alula/resources/m2m/m2m_central_station.rb', line 72 def respond_to_missing?(method, include_private = false) QueryInterface.new(self).respond_to?(method, include_private) || super end |
.retrieve(id) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/alula/resources/m2m/m2m_central_station.rb', line 51 def retrieve(id) built_filters = {} built_filters['AppName'] = id response = Alula::Client.request(:post, self.resource_url('GetCentralStationProxies'), built_filters, {}) if response.ok? item = build_model(self, response.data.fetch('ResponseBody', {})) item.rate_limit = response.rate_limit item else error_class = M2MError.for_response(response) raise error_class end end |