# -*- encoding: utf-8 -*- # stub: nmi_direct_post 0.3.2 ruby lib Gem::Specification.new do |s| s.name = "nmi_direct_post".freeze s.version = "0.3.2".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Isaac Betesh".freeze] s.date = "2020-11-13" s.description = "Gem that encapsulates the NMI Direct Post API in an ActiveRecord-like syntax".freeze s.email = ["iybetesh@gmail.com".freeze] s.files = [".gitignore".freeze, ".rspec".freeze, ".simplecov".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "lib/nmi_direct_post.rb".freeze, "lib/nmi_direct_post/base.rb".freeze, "lib/nmi_direct_post/customer_vault.rb".freeze, "lib/nmi_direct_post/logger.rb".freeze, "lib/nmi_direct_post/transaction.rb".freeze, "lib/nmi_direct_post/version.rb".freeze, "nmi_direct_post.gemspec".freeze, "spec/base_spec.rb".freeze, "spec/customer_vault_spec.rb".freeze, "spec/logger_spec.rb".freeze, "spec/spec_helper.rb".freeze, "spec/support/credentials.rb.example".freeze, "spec/support/test_credentials.rb".freeze, "spec/transaction_spec.rb".freeze] s.homepage = "https://github.com/betesh/nmi_direct_post".freeze s.licenses = ["MIT".freeze] s.rubygems_version = "3.5.10".freeze s.summary = "# NmiDirectPost NmiDirectPost is a gem that encapsulates the NMI Direct Post API in an ActiveRecord-like syntax. For more information on the NMI Direct Post API, see: https://secure.nmi.com/merchants/resources/integration/integration_portal.php To mimic ActivRecord syntax, it is necessary to blur, from the client's standpoint, the boundary between NMI's Direct Post API and its Query API. This fuzziness is part of the encapsulation. ## Installation Add this line to your application's Gemfile: gem 'nmi_direct_post' And then execute: $ bundle Or install it yourself as: $ gem install nmi_direct_post ## Usage 1) Before you query or post, you probably want to set a default username and password: NmiDirectPost::Base.establish_connection(\"MY_NMI_USERNAME\", \"MY_NMI_PASSWORD\") If you don't set a default, you'll need to include the username and password in the hash passed to the initializer when instantiating a new Transaction or CustomerVault. Theoretically, you can use a different connection for NmiDirectPost::Transaction or NmiDirectPost::CustomerVault by calling establish_connection on either of those derived classes, instead of on Base. However, it's hard to imagine a case where this would be useful; the option is only present to mimic the syntax of ActiveRecord. 2) Query the API: NmiDirectPost::Transaction.find_by_transaction_id(123456789, \"MyUsername\", \"MyPassword\") NmiDirectPost::Transaction.find_by_transaction_id(123456789) # If you've already called establish_connection NmiDirectPost::CustomerVault.find_by_customer_vault_id(123123123) # Note that there is no way to pass a username and password to this method. You must call establish_connection beforehand. 3) Create a CustomerVault: george = NmiDirectPostCustomerVault.new(:first_name => 'George', :last_name => 'Washington', :cc_number => '4111111111111111', :cc_exp => '03/17') george.create 4) Update a CustomerVault: george.update!(:email => 'el_primero_presidente@whitehouse.gov', :address_1 => '1600 Pennsylvania Ave NW', :city => 'Washington', :state => 'DC', :postal_code => '20500') ALTERNATIVELY: george.email = 'el_primero_presidente@whitehouse.gov' george.address_1 = '1600 Pennsylvania Ave NW' george.city = 'Washington' george.state = 'DC' george.postal_code = '20500' george.save! # Returns true 5) Delete a CustomerVault: george.destroy # Returns the CustomerVault 6) Reload a CustomerVault: george.email = 'el_primero_presidente@whitehouse.gov' george.reload # Returns the Customer Vault george.email # Returns the previously set email 7) CustomerVault class methods: NmiDirectPost::CustomerVault.all_ids # Returns array of `customer_vault_id`s NmiDirectPost::CustomerVault.first NmiDirectPost::CustomerVault.last NmiDirectPost::CustomerVault.all # Returns very, very big array. This method had very poor performance and could be optimized significantly in a future version of this gem. Note that there is no way to pass a username and password to these methods. You must call establish_connection beforehand. 8) Create a Transaction: parking_ticket = NmiDirectPost::Transaction(:type => :sale, :amount => 150.01, :customer_vault_id => george.customer_vault_id) parking_ticket.save! # Returns true ## Contributing 1. Fork it 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 new Pull Request".freeze s.test_files = ["spec/base_spec.rb".freeze, "spec/customer_vault_spec.rb".freeze, "spec/logger_spec.rb".freeze, "spec/spec_helper.rb".freeze, "spec/support/credentials.rb.example".freeze, "spec/support/test_credentials.rb".freeze, "spec/transaction_spec.rb".freeze] s.specification_version = 4 s.add_development_dependency(%q.freeze, [">= 1.3".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_runtime_dependency(%q.freeze, [">= 0".freeze]) s.add_runtime_dependency(%q.freeze, [">= 4.0".freeze]) end