New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mind_meister_client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mind_meister_client

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mind Meister Ruby client

Join the chat at https://gitter.im/roolo/mind_meister_client

Client for API of web based and mobile mind mapping app -- MindMeister

Installation

Add this line to your application's Gemfile:

gem 'mind_meister_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mind_meister_client

Usage

I've maid one testing Rails app, and the usage was as follows.

app/controllers/application_controller.rb

  before_action :setup_mm_client

  private

  def setup_mm_client
    @mm_client = MindMeisterClient::Requester.new '1625a1388f512a203faa43e8685bcdde',
                                                  '2d845879a2f2a3b1'

    @mm_client.auth_token= current_user.mm_auth_token if current_user
  end

(current_user comes from devise)

app/controllers/welcome_controller.rb

def index
  begin
    @maps = @mm_client.maps_get_list
  rescue MindMeisterClient::ApiCallRequiredError => e
    redirect_to e.api_call_url
  end

end

# MindMeister will point user to this url after successful authorization
def callback
  auth_data = @mm_client.callback params[:frob]

  user = User.find_or_create_by email: auth_data[:auth][:user][:email] do |user|
    user.mm_auth_token = auth_data[:auth][:token]
    user.full_name = auth_data[:auth][:user][:fullname]
  end

  sign_in(:user, user)

  redirect_to 'index'
end

config/routes.rb

root 'welcome#index'
get 'welcome/callback'

devise_for :users

app/views/welcome/index.html.erb

My maps

<ul>
  <% @maps[:maps][:map].each do |map_data| %>
  <li><%= map_data[:title] %> (ID: <%= map_data[:id] %>)</li>
  <% end %>
</ul>

And also there was needed migration to adjust scheme for User model

def change
  change_table :users do |t|
    t.column :mm_auth_token,  :string
    t.column :full_name,      :string
  end
end

This implementation is very far from production-ready, but I hope it'll help as a quick start.

Contributing

  1. Fork it ( https://github.com/roolo/mind_meister_client/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 30 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc