Module: Hashblue::API
Overview
It’s the Hashblue API gem
Connecting
Hashblue API requires ActiveSupport; if this isn’t already loaded, you’ll need to ensure that it is available - either by requiring rubygems, or ensuring it is in the LOAD_PATH
already.
To connect to the Hashblue API, you need to set the base URL, and provide your credentials (you can find these in your hashblue.com account). For example:
require 'active_support/all' # unless you have already loaded it
require 'hashblue/api'
Hashblue::API.base_uri "https://api.hashblue.apigee.com"
Hashblue::API.basic_auth "[email protected]", "yourapikey"
Using the API
Everything is loaded via your subscriber:
subscriber = Hashblue::API::Subscriber.find("yourapikey")
Once you have this, you can load all messages, all contacts, or all messages for a specific contact:
= subscriber.
all_contacts = subscriber.contacts
= all_contacts.first.
Interacting with messages
It’s simple to delete a message:
.first.delete
This message is now deleted. You can see a list of all deleted messages via the subscriber:
subscriber.
Defined Under Namespace
Modules: Request, TestHelper Classes: AccessDeniedError, BadRequestError, BadResponseError, Contact, Error, Message, Model, NotFoundError, NotRespondingError, RateLimitError, ServiceUnavailableError, Subscriber
Class Method Summary collapse
-
.timeout(value) ⇒ Object
Sets the timeout used before raising an error.
Methods included from Request
_request, _with_timeout, delete, get, post
Class Method Details
.timeout(value) ⇒ Object
Sets the timeout used before raising an error.
67 68 69 |
# File 'lib/hashblue/api.rb', line 67 def self.timeout(value) [:timeout] = value end |