Class: ActionKitRest::Tag

Inherits:
Base
  • Object
show all
Defined in:
lib/action_kit_rest/tag.rb

Instance Method Summary collapse

Methods inherited from Base

#create, #get, #list, #normalized_base_path, #update

Instance Method Details

#base_pathObject



3
4
5
# File 'lib/action_kit_rest/tag.rb', line 3

def base_path
  'tag'
end

#find(name) ⇒ Object



7
8
9
10
# File 'lib/action_kit_rest/tag.rb', line 7

def find(name)
  response = list(name: name)
  response.obj.first
end

#find_or_create(name) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/action_kit_rest/tag.rb', line 12

def find_or_create(name)
  tag = find(name)
  if tag.blank?
    tag = create(name: name)
  end
  tag
end