class Megam::RestAdapter

Attributes

api_key[R]
email[R]
headers[R]
host[R]
master_key[R]
org_id[R]
password_hash[R]

the name :password is used as attr_accessor in accounts, hence we use gpassword

Public Class Methods

new(o) click to toggle source

clean up this module later.

# File lib/megam/core/rest_adapter.rb, line 15
def initialize(o)
    @email            = o[:email]
    @api_key          = o[:api_key] || nil
    @master_key       = o[:master_key] || nil
    @host             = o[:host]
    @password_hash    = o[:password_hash] || nil
    @org_id           = o[:org_id]
    @headers          = o[:headers]
end

Public Instance Methods

megam_rest() click to toggle source

Build a megam api client

Parameters

api

The Megam::API client

# File lib/megam/core/rest_adapter.rb, line 29
def megam_rest
    options = {
      :email => email,
      :api_key => api_key,
      :org_id => org_id,
      :password_hash => password_hash,
      :master_key => master_key,
      :host => host
    }
    if headers
      options[:headers] = headers
    end
    Megam::API.new(options)
end