class Kodmin::Consumer
Consumer
of Kong API.
Attributes
created_at[RW]
custom_id[RW]
id[RW]
username[RW]
Public Class Methods
new(attributes = {})
click to toggle source
New a consumer. @param attributes [Hash] attributes of a consumer.
# File lib/kodmin/consumers.rb, line 12 def initialize(attributes = {}) from_hash(attributes) end
Public Instance Methods
from_hash(attributes)
click to toggle source
Assign attributes from a Hash. @param attributes [Hash] attributes.
# File lib/kodmin/consumers.rb, line 18 def from_hash(attributes) attributes.each_key do |key| setter = "#{key}=".to_sym send(setter, attributes[key]) if respond_to?(setter) end end
to_hash()
click to toggle source
# File lib/kodmin/consumers.rb, line 25 def to_hash hash = {} hash[:id] = id unless id.nil? hash[:username] = username unless username.nil? hash[:custom_id] = custom_id unless custom_id.nil? hash[:created_at] = created_at unless created_at.nil? hash[:tags] = tags unless tags.nil? hash end