Class: KillBillClient::Model::TagDefinition

Inherits:
TagDefinitionAttributes show all
Defined in:
lib/killbill_client/models/tag_definition.rb

Constant Summary collapse

KILLBILL_API_TAG_DEFINITIONS_PREFIX =
"#{KILLBILL_API_PREFIX}/tagDefinitions"

Constants inherited from Resource

Resource::KILLBILL_API_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#etag, #response, #session_id, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json

Class Method Details

.all(options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/killbill_client/models/tag_definition.rb', line 7

def all(options = {})
  get KILLBILL_API_TAG_DEFINITIONS_PREFIX,
      {},
      options
end

.find_by_name(name, options = {}) ⇒ Object



13
14
15
# File 'lib/killbill_client/models/tag_definition.rb', line 13

def find_by_name(name, options = {})
  self.all(options).select { |tag_definition| tag_definition.name == name }.first
end

Instance Method Details

#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/killbill_client/models/tag_definition.rb', line 18

def create(user = nil, reason = nil, comment = nil, options = {})
  created_tag_definition = self.class.post KILLBILL_API_TAG_DEFINITIONS_PREFIX,
                                           to_json,
                                           {},
                                           {
                                               :user => user,
                                               :reason => reason,
                                               :comment => comment,
                                           }.merge(options)
  created_tag_definition.refresh(options)
end