In this example, we will discuss step by step how to add sadad payment to your rails app using moyasar gem.
- Moyasar Account.
- Moyasar ruby gem.
- Ruby >= 2.1.10 installed.
- Rails gem installed.
| def generate_objects(object_type, obj_ary, default = {}, attr_names = {}): | |
| """Generate objects that is given in `obj_ary` of class `object_type`. | |
| Parameters | |
| ---------- | |
| object_type : str | |
| the class name | |
| obj_ary : array | |
| object attribute that will populate the object. | |
| default : dict |
| # port of Python's difflib. | |
| # | |
| # Copyright (c) 2001-2008 Python Software Foundation; All Rights Reserved | |
| # Copyright (c) 2008-2011 Kouhei Sutou; All Rights Reserved | |
| # | |
| # It is free software, and is distributed under the Ruby | |
| # license and/or the PSF license. See the COPYING file and | |
| # PSFL file. | |
| # Carry this code from testunit/testunit project. |
| require 'csv' | |
| require 'json' | |
| require 'itunes-search-api' | |
| require 'market_bot' | |
| query = ARGV.first | |
| puts query |
| require 'date' | |
| def season(date) | |
| case date.yday | |
| when 80..202 then "Spring" | |
| when 203..264 then "Summer" | |
| when 265..355 then "Autumn" | |
| else | |
| "Winter" | |
| end |
| currencies = { | |
| "aed": { | |
| "priority": 100, | |
| "iso_code": "AED", | |
| "name": "United Arab Emirates Dirham", | |
| "symbol": "د.إ", | |
| "alternate_symbols": ["DH", "Dhs"], | |
| "subunit": "Fils", | |
| "subunit_to_unit": 100, | |
| "symbol_first": false, |
In this example, we will discuss step by step how to add sadad payment to your rails app using moyasar gem.
| # Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros | |
| # | |
| # Optimized version which uses to_yaml for content creation and checks | |
| # that models are ActiveRecord::Base models before trying to fetch | |
| # them from database. | |
| namespace :db do | |
| namespace :fixtures do | |
| desc 'Dumps all models into fixtures.' | |
| task :dump => :environment do | |
| models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s| |