Class: Alula::M2MCentralStation
- Inherits:
-
M2MRestResource
- Object
- M2MRestResource
- Alula::M2MCentralStation
show all
- Extended by:
- ResourceAttributes
- Defined in:
- lib/alula/resources/m2m/m2m_central_station.rb
Constant Summary
collapse
- DEFAULT_PAGE_NUMBER =
1
Class Method Summary
collapse
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
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 = {}
= filters.delete(:page)
if
built_filters['Page'] = [:number]
built_filters['PageSize'] = [: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', {}), )
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
|