Sha256: ed473d049d852656ab98a79c93207166303cb7a765ee3f2a8c3e814d800e9402
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true require "whats/actions/check_contacts" require "whats/actions/send_message" require "whats/actions/send_hsm_message" module Whats class Api def initialize(base_path) @base_path = base_path end def check_contacts(numbers) Actions::CheckContacts.new(client, numbers).call end def check_contact(number) response = check_contacts([number]) result = \ response["contacts"].reduce({}) do |temp, hash| temp.merge(hash["input"] => hash) end result[number] end def send_message(username, body) Actions::SendMessage.new(client, username, body).call end def send_hsm_message(username, namespace, element_name, params) Actions::SendHsmMessage.new( client, username, namespace, element_name, params ).call end private attr_reader :base_path def client @client ||= Whats::Client.new(base_path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whatsapp-0.1.4 | lib/whats/api.rb |