module Giraffi::Client::Axions

Defines methods related to the axions

Public Instance Methods

add_medium_to_axion(*args) click to toggle source

Adds a medium to the axion

@requires_apikey Yes @param args [Array] A set of params to add a medium to the axion @option args [String] The numerical ID of the related axion @option args [String] The numerical ID of the medium to add @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 69
def add_medium_to_axion(*args)
  raise ArgumentError.new('The method `add_medium_to_axion` requires 2 argments (axion-id and medium-id)') if args.size != 2
  self.class.put("/axions/#{args[0]}/media/#{args[-1]}.json?apikey=#{apikey}", :body => {})
end
create_axion(options={}) click to toggle source

Creates a new axion

@requires_apikey Yes @param options [Hash] A set of attributes to create a new axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 39
def create_axion(options={})
  self.class.post("/axions.json?apikey=#{apikey}", :query => { :axion => options })
end
destroy_axion(id) click to toggle source

Deletes the axion

@requires_apikey Yes @param id [String] The numerical ID of the desired axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 79
def destroy_axion(id)
  self.class.delete("/axions/#{id}?apikey=#{apikey}")
end
execute_axion(id) click to toggle source

Executes the desired axion

@requires_apikey Yes @param id [String] The numerical ID of the desired axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 48
def execute_axion(id)
  self.class.post("/axions/#{id}/execute.json?apikey=#{apikey}")
end
find_axion(id) click to toggle source

Returns the desired axion

@requires_apikey Yes @param id [String] The numerical ID of the desired axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 20
def find_axion(id)
  self.class.get("/axions/#{id}.json?apikey=#{apikey}")
end
find_axions(options={}) click to toggle source

Returns the desired axions

@requires_apikey Yes @param options [Hash] The request params to retrieve the desired axions @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 11
def find_axions(options={})
  self.class.get("/axions.json?apikey=#{apikey}", :query => options)
end
find_media_by_axion(id, options={}) click to toggle source

Returns all media related to the desired axion

@requires_apikey Yes @param id [String] The numerical ID of the desired axion @param options [Hash] A set of params to retrieve media related the axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 30
def find_media_by_axion(id, options={})
  self.class.get("/axions/#{id}/media.json?apikey=#{apikey}", :query => options)
end
remove_medium_from_axion(*args) click to toggle source

Removes a medium from the axion

@requires_apikey Yes @param args [Array] A set of params to remove a medium from the axion @option args [String] The numerical ID of the related axion @option args [String] The numerical ID of the axion to remove @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 90
def remove_medium_from_axion(*args)
  raise ArgumentError.new('The method `remove_medium_from_axion` requires 2 argments (axion-id and medium-id)') if args.size != 2
  self.class.delete("/axions/#{args[0]}/media/#{args[-1]}.json?apikey=#{apikey}")
end
update_axion(id, options={}) click to toggle source

Updates the desired axion

@requires_apikey Yes @param id [String] The numerical ID of the desired axion @param options [Hash] A set of attributes to update the axion @return [HTTParty::Response]

# File lib/giraffi/client/axions.rb, line 58
def update_axion(id, options={})
  self.class.put("/axions/#{id}.json?apikey=#{apikey}", :query => { :axion => options }, :body => {})
end