--- !ruby/object:Gem::Specification name: nmi_direct_post version: !ruby/object:Gem::Version version: 0.2.0 platform: ruby authors: - Isaac Betesh autorequire: bindir: bin cert_chain: [] date: 2015-05-19 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '1.3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '1.3' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rspec-rails requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: simplecov requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: addressable requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: activemodel requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '3.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '3.0' description: Gem that encapsulates the NMI Direct Post API in an ActiveRecord-like syntax email: - iybetesh@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".rspec" - ".simplecov" - Gemfile - LICENSE.txt - README.md - Rakefile - lib/nmi_direct_post.rb - lib/nmi_direct_post/base.rb - lib/nmi_direct_post/customer_vault.rb - lib/nmi_direct_post/logger.rb - lib/nmi_direct_post/transaction.rb - lib/nmi_direct_post/version.rb - nmi_direct_post.gemspec - spec/base_spec.rb - spec/customer_vault_spec.rb - spec/logger_spec.rb - spec/spec_helper.rb - spec/support/credentials.rb.example - spec/support/test_credentials.rb - spec/transaction_spec.rb homepage: https://github.com/betesh/nmi_direct_post licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.3 signing_key: specification_version: 4 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 can query or post, establish the connection: NmiDirectPost::Base.establish_connection("MY_NMI_USERNAME", "MY_NMI_PASSWORD") 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) NmiDirectPost::CustomerVault.find_by_customer_vault_id(123123123) 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. 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' test_files: - spec/base_spec.rb - spec/customer_vault_spec.rb - spec/logger_spec.rb - spec/spec_helper.rb - spec/support/credentials.rb.example - spec/support/test_credentials.rb - spec/transaction_spec.rb