Class: Ghost::Resources::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ghost/resources/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, config:) ⇒ Base

Returns a new instance of Base.



94
95
96
97
# File 'lib/ghost/resources/base.rb', line 94

def initialize(client:, config:)
  @client = client
  @config = config
end

Class Method Details

.actions(*action_names) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ghost/resources/base.rb', line 7

def actions(*action_names)
  @defined_actions = action_names

  action_names.each do |action|
    case action
    when :browse then define_browse
    when :read then define_read
    when :add then define_add
    when :edit then define_edit
    when :delete then define_delete
    when :upload then define_upload
    end
  end
end

.defined_actionsObject



22
23
24
# File 'lib/ghost/resources/base.rb', line 22

def defined_actions
  @defined_actions || []
end

.resource_nameObject



26
27
28
# File 'lib/ghost/resources/base.rb', line 26

def resource_name
  name.split("::").last.downcase
end