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

api_connect_client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api_connect_client

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Api Connect Client Build Status Gem Version

This gem is used to interact with the Developer Portal REST APIs to perform some of the operations that are normally carried out in the Developer Portal UI.

Installation

Add this line to your application's Gemfile:

gem 'api_connect_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install api_connect_client

Configuration

The Developer Portal REST APIs requires you to define a context with the form of organization.space where lives the catalog you are trying to interact with. In order to configure this gem you need to register the context:

ApiConnectClient::Config.register_context("your_bluemix_context")

In rails you can create an initializer in config/initializers (e.g. api_connect_client.rb) and define your context.

The endpoint used to interact with this APIs is https://us.apiconnect.ibmcloud.com/v1/portal You can also register a custom endpoint like this:

ApiConnectClient::Config.register_endpoint("your_custom_endpoint")

Usage

Once you have configured your context you can interact with the APIs in two different ways:

  • Manager:

    • Create users
    • List public products
    • Show an specific product
  • Developer:

    • Create applications
    • List applications
    • Show an specific application
    • Update application information
    • Update application credentials
    • Subscribe application to a plan
    • List public APIs and a specific swagger spec

Initialize manager

To interact as a manager you need to initialize it like this:

manager = ApiConnectClient::Manager.new('manager_email', 'manager_password')
Create user

Then with the manager you can create a new user:

manager.create_user(first_name, last_name, organization_name, username, password)
List public products

To list public products:

manager.list_products

Which will return an array with the public products of your catalog with the following structure:

[
  {
    "id": "5a0333569cf1b5ba87c1fd2f",
    "info": {
      "name": "product_name",
      "title": "Product Title",
      "version": "1.0.1",
      "description": "Product description"
    },
    "url": "https://us.apiconnect.ibmcloud.com/v1/portal/products/5a0333569cf1b5ba87c1fd2f",
    "status": "published"
  },
  {
    "id": "5a0333569cf1b5ba87c1fd2a",
    "info": {
      "name": "product_name",
      "title": "Product Title",
      "version": "1.0.1",
      "description": "Product description",
      "categories": [
        "mock"
      ]
    },
    "url": "https://us.apiconnect.ibmcloud.com/v1/portal/products/5a0333569cf1b5ba87c1fd2a",
    "status": "published"
  }
]
Show a product

If you want to retrieve an specific product you can call:

manager.show_product(product_id)

Initialize Developer

To interact as a developer you need to initialize it like this:

developer = ApiConnectClient::Developer.new('developer_email', 'developer_password', 'organization_id')
Create applications

Then with the developer you can create a new application:

developer.create_application(name, description, oauth_redirect_url, public_app = false)
List applications

List the applications owned by the developer:

developer.list_applications
Show an specific application
developer.show_application(app_id)
Update application information
developer.update_application(app_id, name, description, oauth_redirect_uri, public_app)
Update application credentials
developer.update_application_credentials(app_id, client_id, client_secret)
Subscribe application to a plan
developer.subscribe_application(app_id, product_id, plan = 'default')
List API and a specific swagger spec
api.list_public_apis
api.get_swagger_from_public_api "5a956c490cf23b2cf8eacfbe"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/api-connect-client.

License

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

FAQs

Package last updated on 14 Mar 2018

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