Class: ATSD::PropertiesService
- Inherits:
-
BaseService
- Object
- BaseService
- ATSD::PropertiesService
- Defined in:
- lib/atsd/services/properties_service.rb
Instance Method Summary collapse
-
#delete(properties) ⇒ self
Delete properties.
-
#delete_match(matchers) ⇒ self
Delete rows that partially match the specified key.
-
#insert(properties) ⇒ self
Insert properties.
-
#query(entity, type, options = {}) ⇒ PropertiesQuery
Create query builder for properties.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from ATSD::BaseService
Instance Method Details
#delete(properties) ⇒ self
Delete properties.
41 42 43 44 45 46 47 48 |
# File 'lib/atsd/services/properties_service.rb', line 41 def delete(properties) properties = Utils.ensure_array(properties).map do |s| s = Property.new(s) if s.is_a? Hash s.to_request_hash.select { |k, v| [:entity, :type, :key].include? k } end @client.properties_delete(properties) self end |
#delete_match(matchers) ⇒ self
Delete rows that partially match the specified key
55 56 57 58 59 60 61 |
# File 'lib/atsd/services/properties_service.rb', line 55 def delete_match(matchers) matchers = Utils.ensure_array(matchers).map do |m| m.camelize_keys end @client.properties_delete_match matchers self end |
#insert(properties) ⇒ self
Insert properties.
27 28 29 30 31 32 33 34 |
# File 'lib/atsd/services/properties_service.rb', line 27 def insert(properties) properties = Utils.ensure_array(properties).map do |s| s = Property.new(s) if s.is_a? Hash s.to_request_hash end @client.properties_insert properties self end |
#query(entity, type, options = {}) ⇒ PropertiesQuery
Create query builder for properties.
14 15 16 17 18 19 20 |
# File 'lib/atsd/services/properties_service.rb', line 14 def query(entity, type, = {}) query = PropertiesQuery.new @client entity = entity.name if entity.is_a? Entity .merge! entity: entity, type: type .each { |option, value| query[option] = value } query end |