class Manabu::ContactTypes
Attributes
client[RW]
Public Class Methods
new(client)
click to toggle source
# File lib/manabu/contact_types.rb, line 5 def initialize(client) @client = client @contact_types = {} end
Public Instance Methods
all()
click to toggle source
# File lib/manabu/contact_types.rb, line 17 def all return @contact_types unless @contact_types.empty? response = @client.get("/contact_types") @contact_types = response[:contact_types].each_with_object({}) do |type, obj| obj[type[:name]] = type[:id] end end
register(name)
click to toggle source
# File lib/manabu/contact_types.rb, line 10 def register(name) response = @client.post("/contact_types", name: name) response[:id] rescue nil end