class SplitApi::Models::Attributes
Public Class Methods
new(config)
click to toggle source
# File lib/splitapi-rb/models/attributes.rb, line 7 def initialize(config) @config = config end
Public Instance Methods
delete(traffic_type_id, attribute_id)
click to toggle source
DELETE /trafficTypes/{traffic_type_id}/schema/{attribute_id}
# File lib/splitapi-rb/models/attributes.rb, line 57 def delete(traffic_type_id, attribute_id) RestClient.delete( "#{@config.base_uri}/trafficTypes/#{traffic_type_id}" \ "/schema/#{attribute_id}", auth_headers) == 'true' end
list(traffic_type_id)
click to toggle source
GET /trafficTypes/{traffic_type_id}/schema
# File lib/splitapi-rb/models/attributes.rb, line 12 def list(traffic_type_id) JSON.parse( RestClient.get( "#{@config.base_uri}/trafficTypes/#{traffic_type_id}/schema", auth_headers ).body ).map do |attribute| DataObjects::Attribute.new( description: attribute['description'], display_name: attribute['displayName'], traffic_type_id: attribute['trafficTypeId'], id: attribute['id'], organization_id: attribute['organizationId'], data_type: attribute['dataType'], is_searchable: attribute['isSearchable'] ) end end
save(attribute)
click to toggle source
PUT /trafficTypes/{traffic_type_id}/schema
# File lib/splitapi-rb/models/attributes.rb, line 31 def save(attribute) attribute = JSON.parse( RestClient.put( "#{@config.base_uri}/trafficTypes/#{attribute[:traffic_type_id]}/schema", { 'id' => attribute[:id], 'trafficTypeId' => attribute[:traffic_type_id], 'displayName' => attribute[:display_name], 'description' => attribute[:description], 'dataType' => attribute[:data_type] }.to_json, auth_headers ).body ) DataObjects::Attribute.new( description: attribute['description'], display_name: attribute['displayName'], traffic_type_id: attribute['trafficTypeId'], id: attribute['id'], organization_id: attribute['organizationId'], data_type: attribute['dataType'], is_searchable: attribute['isSearchable'] ) end