Class: Cloudflare::Firewall::Rules

Inherits:
Representation
  • Object
show all
Includes:
Paginate
Defined in:
lib/cloudflare/firewall.rb

Instance Method Summary collapse

Methods included from Paginate

#each, #empty?, #find_by_id

Methods inherited from Representation

#process_response, #represent, #represent_message, #to_hash

Instance Method Details

#each_by_value(value, &block) ⇒ Object



68
69
70
# File 'lib/cloudflare/firewall.rb', line 68

def each_by_value(value, &block)
	each(configuration_value: value, &block)
end

#representationObject



49
50
51
# File 'lib/cloudflare/firewall.rb', line 49

def representation
	Rule
end

#set(mode, value, notes: nil, target: 'ip') ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/cloudflare/firewall.rb', line 53

def set(mode, value, notes: nil, target: 'ip')
	notes ||= "cloudflare gem [#{mode}] #{Time.now.strftime('%m/%d/%y')}"

	message = self.post({
		mode: mode.to_s,
		notes: notes,
		configuration: {
			target: target,
			value: value.to_s,
		}
	})

	represent_message(message)
end