Socket
Book a DemoInstallSign in
Socket

cccode

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cccode

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Cccode

Country and Currency Code provides quick access to country and currency data via SOAP webservice provided by http://www.webservicex.net.

The data of all countries can be accessed directly via SOAP or be persisted and used via local database access.

Installation

Add this line to your application's Gemfile:

gem 'cccode'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cccode

After the gem is installed you need to create the country_codes table via the gem`s generator:

$ rails g cccode:install
$ rake db:migrate

Usage

Enable usage by adding this to your class/ ruby file:

require 'Cccode'

Soap

This section explains how to call the web service via SOAP directly. For quick access via local db see next section 'Database'.

Get all countries as an array:

Cccode.get_countries

Get country code by country:

Cccode.get_country_code(<country name>)

Get currency by country:

Cccode.get_currency(<country name>)

Get currency code by currency:

Cccode.get_currency_code(<currency name>)

Note: all these actions DO NOT persist the data. To achieve that see 'Database' section!

Database

To get all available data at once and fill the database (reset is executed upfront):

Cccode.get_all

Reset (truncate) conutry_codes table:

Cccode.reset

Check if data exists:

Cccode::CountryCode.exists?

Get all data for a country:

data = Cccode::Codes.new(<country name>)

Example: data = Cccode::Codes.new('Germany') returns:

data.country       = 'Germany'
data.country_code  = 'de'
data.currency      = 'Mark'
data.currency_code = 'DEM'


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cherrystoned/cccode.

License

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

FAQs

Package last updated on 29 Jan 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.