Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Eptrn yml #1

Merged
merged 15 commits into from Apr 3, 2013

Conversation

Projects
None yet
3 participants
Contributor

Doppp commented Apr 3, 2013

@azach, ready to launch?

azach commented on f87aa0f Mar 29, 2013

🆒

azach commented on 4bb4574 Mar 30, 2013

@jianxioy let me know what you think about this approach

Contributor

Doppp replied Apr 1, 2013

This is sick, @azach. I'll start working off this branch! @tdumitrescu, good shizzle!

this shit is sweet. is there going to be different code/behavior for the different parser subclasses? right now there are only differences in data (schema location), which indicates that you only need the Parser class, initialized with the right schema. e.g.

module Paxmex
  require 'paxmex/parser'

  def self.parse_eptrn(file)
    Parser.new(file, schema: 'eptrn').parse
  end

  def self.parse_epraw(file)
    Parser.new(file, schema: 'epraw').parse
  end
end

class Paxmex::Parser
  SCHEMATA = %w(epraw eptrn).reduce({}) { |h, fn| h.merge(fn => YAML::load(File.open("config/#{fn}.yml")) }

  def initialize(path, options = {})
    @path = path
    @schema = Paxmex::Schema.new(SCHEMATA[options[:schema]])
  end
end

nope, there shouldn't be. great idea!

in fact, i would skip the Schema.new call on every parse, since the schema objects seem to be a static resource:

class Paxmex::Parser
  SCHEMATA = %w(epraw eptrn).reduce({}) do |h, fn|
    h.merge(fn => Paxmex::Schema.new(YAML::load(File.open("config/#{fn}.yml")))
  end

  def initialize(path, options = {})
    @path = path
    @schema = SCHEMATA[options[:schema]]
  end
end
Contributor

Doppp commented on 3267be4 Apr 2, 2013

@azach, how detailed should the documentation be? Am I missing anything?

what do these methods return? that's a basic critical thing to document

Contributor

Doppp replied Apr 2, 2013

Good call. Changes here. Let me know what you think.

so is this stuff all dummy data or did it also come from parsing one of our production data files?

Contributor

Doppp replied Apr 3, 2013

It is output from our dummy files.

Contributor

Doppp replied Apr 3, 2013

Which are scrambled.

cool. only thing i would still add to the readme is something a bit more explicit about the required input formats. just something like:

Example

require 'paxmex'
Paxmex.parse_eptrn('/path/to/amex/eptrn/raw/file')
Paxmex.parse_epraw('/path/to/amex/epraw/raw/file')

The input file for either method is a data report file provided by American Express in the RAW or TRN format. We gives you a dummy example (at some location). Both methods return a readable hash in the following format:

Contributor

Doppp replied Apr 3, 2013

Sounds good. I'll do that. Thanks!

azach commented Apr 3, 2013

Looks good.

Doppp added a commit that referenced this pull request Apr 3, 2013

@Doppp Doppp merged commit 8b1893a into master Apr 3, 2013

@Doppp Doppp deleted the eptrn_yml branch Apr 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment