Class: Mush::Service

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/mush/service.rb

Overview

This is the class all the services must inherit from.

Instance Method Summary collapse

Instance Method Details

#authorize(args = {}) ⇒ Object



20
21
22
23
24
# File 'lib/mush/service.rb', line 20

def authorize(args = {})
  raise InvalidAuthorizationData.new("Invalid Authorization Data, please provide both login and apikey") unless valid_authorization_data? args
  @login = options[:login]
  @apikey = options[:apikey]
end

#get(path, options = {}) ⇒ Object

wrapper for HTTParty.get



8
9
10
# File 'lib/mush/service.rb', line 8

def get(path, options = {})
  self.class.get(path, options)
end

#post(path, payload, options = {}) ⇒ Object



12
13
14
# File 'lib/mush/service.rb', line 12

def post(path, payload, options = {})
  self.class.post(path, options.merge(:body => payload))
end

#shortenObject



16
17
18
# File 'lib/mush/service.rb', line 16

def shorten(*)
  raise InterfaceMethodNotImplementedError.new("Service#shorten must be overridden in subclasses")
end