Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geewiz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geewiz

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Geewiz

SDK for interacting with Geewiz. Works with Ruby 2.6 (the version that currently come preinstalled on MacOS) and above.

Installation

For use with MacOS's system Ruby 2.6.0 using bundler

To start a new project using MacOS's preinstalled Ruby:

Make a new directory for your project

mkdir my-new-project
cd my-new-project

Configure Bundler to use the vendor/bundle directory for your gems instead of installing them system wide, which requires root access:

bundle config --local path vendor/bundle

# Ignore the bundled gems in git
echo /vendor/ >> .gitignore

Create a new Gemfile

# Make a new Gemfile
bundle init

# Add the gem to the Gemfile
bundle add geewiz

To use the gem in your project:

require 'bundler/setup'
require 'geewiz'

Geewiz.card "hello-world-card"

For most other cases:

bundle add geewiz

or

gem install geewiz

Usage

Requiring the gem

require 'bundler/setup' # you may need to require this if you're using bundler

require 'geewiz'

Showing a card

# show a card with the id "my_card_id"
result = Geewiz.card :my_card_id
result = Geewiz.card "another-card-id" # all data going to Geewiz is json encoded, so either symbols or strings are fine

# show a card with the id "my_card_id" override `type` and `selectOne` parameters
result = Geewiz.card :my_card_id, type: "selectOne", items: ["one", "two", "three"]

# show a card with no id
result = Geewiz.card type: "selectOne", items: ["one", "two", "three"]

# `vars:` can be used to send variables to Geewiz before showing a card
#    (it's a bit cleaner than using `Geewiz.vars[]=` directly)
result = Geewiz.card :my_card, vars: { my_var: "my value", another_var: "another value" }

# if card doesn't have an input, or you don't need the input:
Geewiz.card :my_card_without_input

Setting a variable

Geewiz.vars[:my_var] = "my value"
Geewiz.vars['my-var-with-dashes'] = "my value" # strings are fine as variable names

# you can use the variables in Ruby
Geewiz.vars[:username] = load_username_from_db

if Geewiz.vars[:username] == 'nicholaides'
  # ...
end

# this also works for setting one variable
Geewiz.var :my_var, "my value"

Setting the title of the app

Geewiz.set title: "my app"

Getting user config

config_value = Geewiz.get_user_config :my_key

Using the global client (simplest way to use the gem)

Geewiz.card :my_card_id

Using a non-global client (better for testing/mocking)

geewiz = Geewiz::Client.new

geewiz.set title: "my app"
geewiz.vars[:my_var] = "my value"
result = geewiz.card :my_card_id

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 19 Aug 2024

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