Sha256: 811358ae206327c8b1acbe2a0a45c77d8db8b1915a441a954eed1622dffa5c5f
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
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["payload"]["results"].reduce({}) do |temp, hash| temp.merge(hash["input_number"] => 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
whatsapp-0.1.3 | lib/whats/api.rb |
whatsapp-0.1.2 | lib/whats/api.rb |
whatsapp-0.1.1 | lib/whats/api.rb |
whatsapp-0.1.0 | lib/whats/api.rb |