Class: Kasabi::Augment::Client

Inherits:
BaseClient show all
Defined in:
lib/kasabi/api/augment.rb

Overview

Client for working with Kasabi Augmentation APIs

Instance Attribute Summary

Attributes inherited from BaseClient

#apikey, #client, #endpoint

Instance Method Summary collapse

Methods inherited from BaseClient

#client_options, #get, #post, #validate_response

Constructor Details

#initialize(endpoint, options = {}) ⇒ Client

Initialize the client to work with a specific endpoint

The options hash can contain the following values:

  • :apikey: required. apikey authorized to use the API

  • :client: HTTPClient object instance



13
14
15
# File 'lib/kasabi/api/augment.rb', line 13

def initialize(endpoint, options={})
  super(endpoint, options)
end

Instance Method Details

#augment(data, content_type = "application/rss+xml") ⇒ Object

Augment data using POSTing it to the API

Currently this is limited to RSS 1.0 feeds

data

a String containing the data to augment



32
33
34
35
36
# File 'lib/kasabi/api/augment.rb', line 32

def augment(data, content_type="application/rss+xml")
response = post(@endpoint, data, {"Content-Type" => "application/rss+xml"})
  validate_response(response)
  return response.content
end

#augment_uri(uri) ⇒ Object

Augment an RSS feed that can be retrieved from the specified URL, against data in this store

uri

the URL for the RSS 1.0 feed



20
21
22
23
24
25
# File 'lib/kasabi/api/augment.rb', line 20

def augment_uri(uri)
  response = get(@endpoint, {"data-uri" => uri})
  validate_response(response)
    
  return response.content
end