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

#uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

attribute, delete, from_json, from_response, get, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json

Class Method Details

.allObject



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

def all
  get KILLBILL_API_TAG_DEFINITIONS_PREFIX
end

.find_by_name(name) ⇒ Object



11
12
13
# File 'lib/killbill_client/models/tag_definition.rb', line 11

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

Instance Method Details

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



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

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