[
  {
    "path": ".gemfiles/rails3_2.gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'rails', '~> 3.2.0'\n\ngemspec path: '../'\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": ".gemfiles/rails4_0.gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'rails', '~> 4.0.0'\n\ngemspec path: '../'\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": ".gemfiles/rails4_1.gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'rails', '~> 4.1.0'\n\ngemspec path: '../'\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": ".gemfiles/rails4_2.gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'rails', '~> 4.2.0'\n\ngemspec path: '../'\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": ".gemfiles/rails5_0.gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'rails', '~> 5.0.0'\n\ngemspec path: '../'\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": ".gitignore",
    "content": "*.rbc\n*.sassc\n.sass-cache\ncapybara-*.html\n.rspec\n/.bundle\n/vendor/bundle\n/log/*\n/tmp/*\n/db/*.sqlite3\n/public/system/*\n/coverage/\n/spec/tmp/*\n**.orig\nrerun.txt\npickle-email-*.html\n/pkg/\nGemfile.lock"
  },
  {
    "path": ".travis.yml",
    "content": "language: ruby\nsudo: false\ncache: bundler\nrvm:\n  - 2.2.2\n  - 2.2.3\n  - 2.2.4\n  - 2.2.5\n  - 2.3.0\n  - 2.3.1\n  # - jruby-1.7.20\n  # - jruby-9.0.0.0\n  - rbx\nmatrix:\n  include:\n    - rvm: 2.2.5\n      gemfile: .gemfiles/rails3_2.gemfile\n    - rvm: 2.3.1\n      gemfile: .gemfiles/rails4_0.gemfile\n    - rvm: 2.3.1\n      gemfile: .gemfiles/rails4_1.gemfile\n    - rvm: 2.3.1\n      gemfile: .gemfiles/rails4_2.gemfile\n    - rvm: 2.3.1\n      gemfile: .gemfiles/rails5_0.gemfile\n  allow_failures:\n    - rvm: rbx\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\n# Declare your gem's dependencies in mailgun_rails.gemspec.\n# Bundler will treat runtime dependencies like base dependencies, and\n# development dependencies will be added by default to the :development group.\ngemspec\n\ngem 'sqlite3', platform: :ruby\ngem 'activerecord-jdbcsqlite3-adapter', platform: :jruby\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2013 Jorge Manrubia\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "MIT-LICENSE",
    "content": "Copyright 2013 Jorge Manrubia\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# mailgun_rails\n\n[![Build Status](https://travis-ci.org/jorgemanrubia/mailgun_rails.svg?branch=master)](https://travis-ci.org/jorgemanrubia/mailgun_rails)\n\n*mailgun_rails* is an Action Mailer adapter for using [Mailgun](http://www.mailgun.com/) in Rails apps. It uses the [Mailgun HTTP API](http://documentation.mailgun.com/api_reference.html) internally.\n\n## Installing\n\nIn your `Gemfile`\n\n```ruby\ngem 'mailgun_rails'\n```\n\n## Usage\n\nTo configure your Mailgun credentials place the following code in the corresponding environment file (`development.rb`, `production.rb`...)\n\n```ruby\nconfig.action_mailer.delivery_method = :mailgun\nconfig.action_mailer.mailgun_settings = {\n\t\tapi_key: '<mailgun api key>',\n\t\tdomain: '<mailgun domain>'\n}\n```\n\nNow you can send emails using plain Action Mailer:\n\n```ruby\nemail = mail from: 'sender@email.com', to: 'receiver@email.com', subject: 'this is an email'\nor \nemail = mail from: 'Your Name Here <sender@email.com>', to: 'receiver@email.com', subject: 'this is an email'\n```\n\n### [Mailgun variables](http://documentation.mailgun.com/user_manual.html#attaching-data-to-messages)\n\n```ruby\nemail.mailgun_variables = {name_1: :value_1, name_2: value_2}\n```\n\n### [Recipient Variables (for batch sending)](http://documentation.mailgun.com/user_manual.html#batch-sending)\n\n```ruby\nemail.mailgun_recipient_variables = {'user_1@email.com' => {id: 1}, 'user_2@email.com' => {id: 2}}\n```\n\n### [Custom MIME headers](http://documentation.mailgun.com/api-sending.html#sending)\n\n```ruby\nemail.mailgun_headers = {foo: 'bar'}\n```\n\n### Mailgun options\n\nTo provide option parameters like `o:campaign` or `o:tag`.\n\n```ruby\nemail.mailgun_options = {campaign: '1'}\n```\n\nPull requests are welcomed\n\n\n"
  },
  {
    "path": "README.rdoc",
    "content": "= MailgunRails\n\nThis project rocks and uses MIT-LICENSE."
  },
  {
    "path": "Rakefile",
    "content": "begin\n  require 'bundler/setup'\nrescue LoadError\n  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'\nend\n\nrequire 'rdoc/task'\n\nRDoc::Task.new(:rdoc) do |rdoc|\n  rdoc.rdoc_dir = 'rdoc'\n  rdoc.title    = 'MailgunRails'\n  rdoc.options << '--line-numbers'\n  rdoc.rdoc_files.include('README.rdoc')\n  rdoc.rdoc_files.include('lib/**/*.rb')\nend\n\nBundler::GemHelper.install_tasks\n\nrequire 'rspec/core/rake_task'\n\nRSpec::Core::RakeTask.new(:spec)\n\ntask default: :spec\n"
  },
  {
    "path": "lib/mailgun_rails/attachment.rb",
    "content": "module MailgunRails\n  class Attachment < StringIO\n    attr_reader :original_filename, :content_type, :path\n\n    def initialize (attachment, *rest)\n      @path = ''\n      if rest.detect {|opt| opt[:inline] }\n        basename = @original_filename = attachment.cid\n      else\n        basename = @original_filename = attachment.filename\n      end\n      @content_type = attachment.content_type.split(';')[0]\n      super attachment.body.decoded\n    end\n  end\nend\n"
  },
  {
    "path": "lib/mailgun_rails/client.rb",
    "content": "require 'rest_client'\n\n\nmodule MailgunRails\n  class Client\n    attr_reader :api_key, :domain, :verify_ssl\n\n    def initialize(api_key, domain, verify_ssl = true)\n      @api_key = api_key\n      @domain = domain\n      @verify_ssl = verify_ssl\n    end\n\n    def send_message(options)\n      RestClient::Request.execute(\n              method: :post,\n              url: mailgun_url,\n              payload: options,\n              verify_ssl: verify_ssl\n      )\n    end\n\n    def mailgun_url\n      api_url+\"/messages\"\n    end\n\n    def api_url\n      \"https://api:#{api_key}@api.mailgun.net/v3/#{domain}\"\n    end\n  end\nend\n"
  },
  {
    "path": "lib/mailgun_rails/deliverer.rb",
    "content": "module MailgunRails\n  class Deliverer\n\n    attr_accessor :settings\n\n    def initialize(settings)\n      self.settings = settings\n    end\n\n    def domain\n      self.settings[:domain]\n    end\n\n    def api_key\n      self.settings[:api_key]\n    end\n\n    def verify_ssl\n      #default value = true\n      self.settings[:verify_ssl] != false\n    end\n\n    def deliver!(rails_message)\n      response = mailgun_client.send_message build_mailgun_message_for(rails_message)\n      if response.code == 200\n        mailgun_message_id = JSON.parse(response.to_str)[\"id\"]\n        rails_message.message_id = mailgun_message_id\n      end\n      response\n    end\n\n    private\n\n    def build_mailgun_message_for(rails_message)\n      mailgun_message = build_basic_mailgun_message_for rails_message\n      transform_mailgun_attributes_from_rails rails_message, mailgun_message\n      remove_empty_values mailgun_message\n\n      mailgun_message\n    end\n\n    def transform_mailgun_attributes_from_rails(rails_message, mailgun_message)\n      transform_reply_to rails_message, mailgun_message if rails_message.reply_to\n      transform_mailgun_variables rails_message, mailgun_message\n      transform_mailgun_options rails_message, mailgun_message\n      transform_mailgun_recipient_variables rails_message, mailgun_message\n      transform_custom_headers rails_message, mailgun_message\n    end\n\n    def build_basic_mailgun_message_for(rails_message)\n      mailgun_message = {\n       from: rails_message[:from].formatted,\n       to: rails_message[:to].formatted,\n       subject: rails_message.subject,\n       html: extract_html(rails_message),\n       text: extract_text(rails_message)\n      }\n\n      [:cc, :bcc].each do |key|\n        mailgun_message[key] = rails_message[key].formatted if rails_message[key]\n      end\n\n      return mailgun_message if rails_message.attachments.empty?\n\n      # RestClient requires attachments to be in file format, use a temp directory and the decoded attachment\n      mailgun_message[:attachment] = []\n      mailgun_message[:inline] = []\n      rails_message.attachments.each do |attachment|\n        # then add as a file object\n        if attachment.inline?\n          mailgun_message[:inline] << MailgunRails::Attachment.new(attachment, encoding: 'ascii-8bit', inline: true)\n        else\n          mailgun_message[:attachment] << MailgunRails::Attachment.new(attachment, encoding: 'ascii-8bit')\n        end\n      end\n\n      return mailgun_message\n    end\n\n    def transform_reply_to(rails_message, mailgun_message)\n      mailgun_message['h:Reply-To'] = rails_message[:reply_to].formatted.first\n    end\n\n    # @see http://stackoverflow.com/questions/4868205/rails-mail-getting-the-body-as-plain-text\n    def extract_html(rails_message)\n      if rails_message.html_part\n        rails_message.html_part.body.decoded\n      else\n        rails_message.content_type =~ /text\\/html/ ? rails_message.body.decoded : nil\n      end\n    end\n\n    def extract_text(rails_message)\n      if rails_message.multipart?\n        rails_message.text_part ? rails_message.text_part.body.decoded : nil\n      else\n        rails_message.content_type =~ /text\\/plain/ ? rails_message.body.decoded : nil\n      end\n    end\n\n    def transform_mailgun_variables(rails_message, mailgun_message)\n      rails_message.mailgun_variables.try(:each) do |name, value|\n        mailgun_message[\"v:#{name}\"] = value\n      end\n    end\n\n    def transform_mailgun_options(rails_message, mailgun_message)\n      rails_message.mailgun_options.try(:each) do |name, value|\n        mailgun_message[\"o:#{name}\"] = value\n      end\n    end\n\n    def transform_custom_headers(rails_message, mailgun_message)\n      rails_message.mailgun_headers.try(:each) do |name, value|\n        mailgun_message[\"h:#{name}\"] = value\n      end\n    end\n\n    def transform_mailgun_recipient_variables(rails_message, mailgun_message)\n      mailgun_message['recipient-variables'] = rails_message.mailgun_recipient_variables.to_json if rails_message.mailgun_recipient_variables\n    end\n\n    def remove_empty_values(mailgun_message)\n      mailgun_message.delete_if { |key, value| value.nil? or\n                                               value.respond_to?(:empty?) && value.empty? }\n    end\n\n    def mailgun_client\n      @maingun_client ||= Client.new(api_key, domain, verify_ssl)\n    end\n  end\nend\n\nActionMailer::Base.add_delivery_method :mailgun, MailgunRails::Deliverer\n"
  },
  {
    "path": "lib/mailgun_rails/mail_ext.rb",
    "content": "module Mail\n  class Message\n    attr_accessor :mailgun_variables\n    attr_accessor :mailgun_options\n    attr_accessor :mailgun_recipient_variables\n    attr_accessor :mailgun_headers\n  end\nend\n"
  },
  {
    "path": "lib/mailgun_rails/version.rb",
    "content": "module MailgunRails\n  VERSION = \"0.9.0\"\nend\n"
  },
  {
    "path": "lib/mailgun_rails.rb",
    "content": "require 'action_mailer'\nrequire 'json'\n\n\nDir[File.dirname(__FILE__) + '/mailgun_rails/*.rb'].each {|file| require file }\n\nmodule MailgunRails\nend\n"
  },
  {
    "path": "mailgun_rails.gemspec",
    "content": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"mailgun_rails/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|\n  s.name        = \"mailgun_rails\"\n  s.version     = MailgunRails::VERSION\n  s.authors     = [\"Jorge Manrubia\"]\n  s.email       = [\"jorge.manrubia@gmail.com\"]\n  s.homepage    = \"https://github.com/jorgemanrubia/mailgun_rails/\"\n  s.summary     = \"Rails Action Mailer adapter for Mailgun\"\n  s.description = \"An adapter for using Mailgun with Rails and Action Mailer\"\n  s.license = 'MIT'\n\n  s.files = Dir[\"{app,config,db,lib}/**/*\", \"MIT-LICENSE\", \"Rakefile\", \"README.rdoc\"]\n  s.test_files = Dir[\"test/**/*\"]\n\n  s.add_dependency \"actionmailer\", \">= 3.2.13\"\n  s.add_dependency \"json\", \">= 1.7.7\"\n  s.add_dependency \"rest-client\", \">= 1.6.7\"\n\n  s.add_development_dependency \"rspec\", '~> 2.14.1'\n  s.add_development_dependency \"rails\", \">= 3.2.13\"\nend\n"
  },
  {
    "path": "spec/dummy/.gitignore",
    "content": "# See http://help.github.com/ignore-files/ for more about ignoring files.\n#\n# If you find yourself ignoring temporary files generated by your text editor\n# or operating system, you probably want to add a global ignore instead:\n#   git config --global core.excludesfile ~/.gitignore_global\n\n# Ignore bundler config\n/.bundle\n\n# Ignore the default SQLite database.\n/db/*.sqlite3\n\n# Ignore all logfiles and tempfiles.\n/log/*.log\n/tmp\n"
  },
  {
    "path": "spec/dummy/README.rdoc",
    "content": "== Welcome to Rails\n\nRails is a web-application framework that includes everything needed to create\ndatabase-backed web applications according to the Model-View-Control pattern.\n\nThis pattern splits the view (also called the presentation) into \"dumb\"\ntemplates that are primarily responsible for inserting pre-built data in between\nHTML tags. The model contains the \"smart\" domain objects (such as Account,\nProduct, Person, Post) that holds all the business logic and knows how to\npersist themselves to a database. The controller handles the incoming requests\n(such as Save New Account, Update Product, Show Post) by manipulating the model\nand directing data to the view.\n\nIn Rails, the model is handled by what's called an object-relational mapping\nlayer entitled Active Record. This layer allows you to present the data from\ndatabase rows as objects and embellish these data objects with business logic\nmethods. You can read more about Active Record in\nlink:files/vendor/rails/activerecord/README.html.\n\nThe controller and view are handled by the Action Pack, which handles both\nlayers by its two parts: Action View and Action Controller. These two layers\nare bundled in a single package due to their heavy interdependence. This is\nunlike the relationship between the Active Record and Action Pack that is much\nmore separate. Each of these packages can be used independently outside of\nRails. You can read more about Action Pack in\nlink:files/vendor/rails/actionpack/README.html.\n\n\n== Getting Started\n\n1. At the command prompt, create a new Rails application:\n       <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)\n\n2. Change directory to <tt>myapp</tt> and start the web server:\n       <tt>cd myapp; rails server</tt> (run with --help for options)\n\n3. Go to http://localhost:3000/ and you'll see:\n       \"Welcome aboard: You're riding Ruby on Rails!\"\n\n4. Follow the guidelines to start developing your application. You can find\nthe following resources handy:\n\n* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html\n* Ruby on Rails Tutorial Book: http://www.railstutorial.org/\n\n\n== Debugging Rails\n\nSometimes your application goes wrong. Fortunately there are a lot of tools that\nwill help you debug it and get it back on the rails.\n\nFirst area to check is the application log files. Have \"tail -f\" commands\nrunning on the server.log and development.log. Rails will automatically display\ndebugging and runtime information to these files. Debugging info will also be\nshown in the browser on requests from 127.0.0.1.\n\nYou can also log your own messages directly into the log file from your code\nusing the Ruby logger class from inside your controllers. Example:\n\n  class WeblogController < ActionController::Base\n    def destroy\n      @weblog = Weblog.find(params[:id])\n      @weblog.destroy\n      logger.info(\"#{Time.now} Destroyed Weblog ID ##{@weblog.id}!\")\n    end\n  end\n\nThe result will be a message in your log file along the lines of:\n\n  Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!\n\nMore information on how to use the logger is at http://www.ruby-doc.org/core/\n\nAlso, Ruby documentation can be found at http://www.ruby-lang.org/. There are\nseveral books available online as well:\n\n* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)\n* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)\n\nThese two books will bring you up to speed on the Ruby language and also on\nprogramming in general.\n\n\n== Debugger\n\nDebugger support is available through the debugger command when you start your\nMongrel or WEBrick server with --debugger. This means that you can break out of\nexecution at any point in the code, investigate and change the model, and then,\nresume execution! You need to install ruby-debug to run the server in debugging\nmode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:\n\n  class WeblogController < ActionController::Base\n    def index\n      @posts = Post.all\n      debugger\n    end\n  end\n\nSo the controller will accept the action, run the first line, then present you\nwith a IRB prompt in the server window. Here you can do things like:\n\n  >> @posts.inspect\n  => \"[#<Post:0x14a6be8\n          @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,\n       #<Post:0x14a6620\n          @attributes={\"title\"=>\"Rails\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]\"\n  >> @posts.first.title = \"hello from a debugger\"\n  => \"hello from a debugger\"\n\n...and even better, you can examine how your runtime objects actually work:\n\n  >> f = @posts.first\n  => #<Post:0x13630c4 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>\n  >> f.\n  Display all 152 possibilities? (y or n)\n\nFinally, when you're ready to resume execution, you can enter \"cont\".\n\n\n== Console\n\nThe console is a Ruby shell, which allows you to interact with your\napplication's domain model. Here you'll have all parts of the application\nconfigured, just like it is when the application is running. You can inspect\ndomain models, change values, and save to the database. Starting the script\nwithout arguments will launch it in the development environment.\n\nTo start the console, run <tt>rails console</tt> from the application\ndirectory.\n\nOptions:\n\n* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications\n  made to the database.\n* Passing an environment name as an argument will load the corresponding\n  environment. Example: <tt>rails console production</tt>.\n\nTo reload your controllers and models after launching the console run\n<tt>reload!</tt>\n\nMore information about irb can be found at:\nlink:http://www.rubycentral.org/pickaxe/irb.html\n\n\n== dbconsole\n\nYou can go to the command line of your database directly through <tt>rails\ndbconsole</tt>. You would be connected to the database with the credentials\ndefined in database.yml. Starting the script without arguments will connect you\nto the development database. Passing an argument will connect you to a different\ndatabase, like <tt>rails dbconsole production</tt>. Currently works for MySQL,\nPostgreSQL and SQLite 3.\n\n== Description of Contents\n\nThe default directory structure of a generated Ruby on Rails application:\n\n  |-- app\n  |   |-- assets\n  |   |   |-- images\n  |   |   |-- javascripts\n  |   |   `-- stylesheets\n  |   |-- controllers\n  |   |-- helpers\n  |   |-- mailers\n  |   |-- models\n  |   `-- views\n  |       `-- layouts\n  |-- config\n  |   |-- environments\n  |   |-- initializers\n  |   `-- locales\n  |-- db\n  |-- doc\n  |-- lib\n  |   |-- assets\n  |   `-- tasks\n  |-- log\n  |-- public\n  |-- script\n  |-- test\n  |   |-- fixtures\n  |   |-- functional\n  |   |-- integration\n  |   |-- performance\n  |   `-- unit\n  |-- tmp\n  |   `-- cache\n  |       `-- assets\n  `-- vendor\n      |-- assets\n      |   |-- javascripts\n      |   `-- stylesheets\n      `-- plugins\n\napp\n  Holds all the code that's specific to this particular application.\n\napp/assets\n  Contains subdirectories for images, stylesheets, and JavaScript files.\n\napp/controllers\n  Holds controllers that should be named like weblogs_controller.rb for\n  automated URL mapping. All controllers should descend from\n  ApplicationController which itself descends from ActionController::Base.\n\napp/models\n  Holds models that should be named like post.rb. Models descend from\n  ActiveRecord::Base by default.\n\napp/views\n  Holds the template files for the view that should be named like\n  weblogs/index.html.erb for the WeblogsController#index action. All views use\n  eRuby syntax by default.\n\napp/views/layouts\n  Holds the template files for layouts to be used with views. This models the\n  common header/footer method of wrapping views. In your views, define a layout\n  using the <tt>layout :default</tt> and create a file named default.html.erb.\n  Inside default.html.erb, call <% yield %> to render the view using this\n  layout.\n\napp/helpers\n  Holds view helpers that should be named like weblogs_helper.rb. These are\n  generated for you automatically when using generators for controllers.\n  Helpers can be used to wrap functionality for your views into methods.\n\nconfig\n  Configuration files for the Rails environment, the routing map, the database,\n  and other dependencies.\n\ndb\n  Contains the database schema in schema.rb. db/migrate contains all the\n  sequence of Migrations for your schema.\n\ndoc\n  This directory is where your application documentation will be stored when\n  generated using <tt>rake doc:app</tt>\n\nlib\n  Application specific libraries. Basically, any kind of custom code that\n  doesn't belong under controllers, models, or helpers. This directory is in\n  the load path.\n\npublic\n  The directory available for the web server. Also contains the dispatchers and the\n  default HTML files. This should be set as the DOCUMENT_ROOT of your web\n  server.\n\nscript\n  Helper scripts for automation and generation.\n\ntest\n  Unit and functional tests along with fixtures. When using the rails generate\n  command, template test files will be generated for you and placed in this\n  directory.\n\nvendor\n  External libraries that the application depends on. Also includes the plugins\n  subdirectory. If the app has frozen rails, those gems also go here, under\n  vendor/rails/. This directory is in the load path.\n"
  },
  {
    "path": "spec/dummy/Rakefile",
    "content": "#!/usr/bin/env rake\n# Add your own tasks in files placed in lib/tasks ending in .rake,\n# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.\n\nrequire File.expand_path('../config/application', __FILE__)\n\nDummy::Application.load_tasks\n"
  },
  {
    "path": "spec/dummy/app/assets/javascripts/application.js",
    "content": "// This is a manifest file that'll be compiled into application.js, which will include all the files\n// listed below.\n//\n// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,\n// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.\n//\n// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the\n// the compiled file.\n//\n// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD\n// GO AFTER THE REQUIRES BELOW.\n//\n//= require jquery\n//= require jquery_ujs\n//= require_tree .\n"
  },
  {
    "path": "spec/dummy/app/assets/stylesheets/application.css",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n */\n"
  },
  {
    "path": "spec/dummy/app/controllers/application_controller.rb",
    "content": "class ApplicationController < ActionController::Base\n  protect_from_forgery\nend\n"
  },
  {
    "path": "spec/dummy/app/helpers/application_helper.rb",
    "content": "module ApplicationHelper\nend\n"
  },
  {
    "path": "spec/dummy/app/mailers/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/mailers/sandbox_mailer.rb",
    "content": "class SandboxMailer < ActionMailer::Base\n  def sandbox\n    mail from: 'some@email.com', to: 'jorge.manrubia@gmail.com', subject: 'this is an email'\n  end\nend"
  },
  {
    "path": "spec/dummy/app/models/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/views/layouts/application.html.erb",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>Dummy</title>\n  <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n  <%= javascript_include_tag \"application\" %>\n  <%= csrf_meta_tags %>\n</head>\n<body>\n\n<%= yield %>\n\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/app/views/sandbox_mailer/sandbox.html.erb",
    "content": "Hi Jorge!"
  },
  {
    "path": "spec/dummy/config/application.rb",
    "content": "require File.expand_path('../boot', __FILE__)\n\nrequire 'rails/all'\n\nBundler.require(*Rails.groups)\nrequire \"mailgun_rails\"\n\nif defined?(Bundler)\n  # If you precompile assets before deploying to production, use this line\n  Bundler.require(*Rails.groups(:assets => %w(development test)))\n  # If you want your assets lazily compiled in production, use this line\n  # Bundler.require(:default, :assets, Rails.env)\nend\n\nmodule Dummy\n  class Application < Rails::Application\n    # Settings in config/environments/* take precedence over those specified here.\n    # Application configuration should go into files in config/initializers\n    # -- all .rb files in that directory are automatically loaded.\n\n    # Custom directories with classes and modules you want to be autoloadable.\n    # config.autoload_paths += %W(#{config.root}/extras)\n\n    # Only load the plugins named here, in the order given (default is alphabetical).\n    # :all can be used as a placeholder for all plugins not explicitly named.\n    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]\n\n    # Activate observers that should always be running.\n    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer\n\n    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.\n    # Run \"rake -D time\" for a list of tasks for finding time zone names. Default is UTC.\n    # config.time_zone = 'Central Time (US & Canada)'\n\n    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.\n    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]\n    # config.i18n.default_locale = :de\n\n    # Configure the default encoding used in templates for Ruby 1.9.\n    config.encoding = \"utf-8\"\n\n    # Configure sensitive parameters which will be filtered from the log file.\n    config.filter_parameters += [:password]\n\n    # Enable escaping HTML in JSON.\n    config.active_support.escape_html_entities_in_json = true\n\n    # Use SQL instead of Active Record's schema dumper when creating the database.\n    # This is necessary if your schema can't be completely dumped by the schema dumper,\n    # like if you have constraints or database-specific column types\n    # config.active_record.schema_format = :sql\n\n    # Enforce whitelist mode for mass assignment.\n    # This will create an empty whitelist of attributes available for mass-assignment for all models\n    # in your app. As such, your models will need to explicitly whitelist or blacklist accessible\n    # parameters by using an attr_accessible or attr_protected declaration.\n    # config.active_record.whitelist_attributes = true\n\n    # Enable the asset pipeline\n    config.assets.enabled = true\n\n    # Version of your assets, change this if you want to expire all your assets\n    config.assets.version = '1.0'\n  end\nend\n"
  },
  {
    "path": "spec/dummy/config/boot.rb",
    "content": "require 'rubygems'\n\n# Set up gems listed in the Gemfile.\nENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)\n\nrequire 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])\n"
  },
  {
    "path": "spec/dummy/config/database.yml",
    "content": "# SQLite version 3.x\n#   gem install sqlite3\n#\n#   Ensure the SQLite 3 gem is defined in your Gemfile\n#   gem 'sqlite3'\ndevelopment:\n  adapter: sqlite3\n  database: db/development.sqlite3\n  pool: 5\n  timeout: 5000\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  adapter: sqlite3\n  database: db/test.sqlite3\n  pool: 5\n  timeout: 5000\n\nproduction:\n  adapter: sqlite3\n  database: db/production.sqlite3\n  pool: 5\n  timeout: 5000\n"
  },
  {
    "path": "spec/dummy/config/environment.rb",
    "content": "# Load the rails application\nrequire File.expand_path('../application', __FILE__)\n\n# Initialize the rails application\nDummy::Application.initialize!\n"
  },
  {
    "path": "spec/dummy/config/environments/development.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb\n\n  # In the development environment your application's code is reloaded on\n  # every request. This slows down response time but is perfect for development\n  # since you don't have to restart the web server when you make code changes.\n  config.cache_classes = false\n\n  # Do not eager load code on boot.\n  config.eager_load = false\n\n  # Log error messages when you accidentally call methods on nil.\n  config.whiny_nils = true\n\n  # Show full error reports and disable caching\n  config.consider_all_requests_local       = true\n  config.action_controller.perform_caching = false\n\n  # Don't care if the mailer can't send\n  config.action_mailer.raise_delivery_errors = false\n\n  # Print deprecation notices to the Rails logger\n  config.active_support.deprecation = :log\n\n  # Only use best-standards-support built into browsers\n  config.action_dispatch.best_standards_support = :builtin\n\n  # Raise exception on mass assignment protection for Active Record models\n  # config.active_record.mass_assignment_sanitizer = :strict\n\n  # Log the query plan for queries taking more than this (works\n  # with SQLite, MySQL, and PostgreSQL)\n  config.active_record.auto_explain_threshold_in_seconds = 0.5\n\n  # Do not compress assets\n  config.assets.compress = false\n\n  # Expands the lines which load the assets\n  config.assets.debug = true\n\n  config.action_mailer.delivery_method = :mailgun\n  config.action_mailer.mailgun_settings = {\n      api_key: ENV['ACTION_MAILER_API_KEY'],\n      domain: 'ACTION_MAILER_DOMAIN'\n  }\n  config.action_mailer.raise_delivery_errors\n\nend\n"
  },
  {
    "path": "spec/dummy/config/environments/production.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb\n\n  # Code is not reloaded between requests\n  config.cache_classes = true\n\n  # Do not eager load code on boot.\n  config.eager_load = true\n\n  # Full error reports are disabled and caching is turned on\n  config.consider_all_requests_local       = false\n  config.action_controller.perform_caching = true\n\n  # Disable Rails's static asset server (Apache or nginx will already do this)\n  config.serve_static_files = false\n\n  # Compress JavaScripts and CSS\n  config.assets.compress = true\n\n  # Don't fallback to assets pipeline if a precompiled asset is missed\n  config.assets.compile = false\n\n  # Generate digests for assets URLs\n  config.assets.digest = true\n\n  # Defaults to nil and saved in location specified by config.assets.prefix\n  # config.assets.manifest = YOUR_PATH\n\n  # Specifies the header that your server uses for sending files\n  # config.action_dispatch.x_sendfile_header = \"X-Sendfile\" # for apache\n  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx\n\n  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.\n  # config.force_ssl = true\n\n  # See everything in the log (default is :info)\n  # config.log_level = :debug\n\n  # Prepend all log lines with the following tags\n  # config.log_tags = [ :subdomain, :uuid ]\n\n  # Use a different logger for distributed setups\n  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)\n\n  # Use a different cache store in production\n  # config.cache_store = :mem_cache_store\n\n  # Enable serving of images, stylesheets, and JavaScripts from an asset server\n  # config.action_controller.asset_host = \"http://assets.example.com\"\n\n  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)\n  # config.assets.precompile += %w( search.js )\n\n  # Disable delivery errors, bad email addresses will be ignored\n  # config.action_mailer.raise_delivery_errors = false\n\n  # Enable threaded mode\n  # config.threadsafe!\n\n  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to\n  # the I18n.default_locale when a translation can not be found)\n  config.i18n.fallbacks = true\n\n  # Send deprecation notices to registered listeners\n  config.active_support.deprecation = :notify\n\n  # Log the query plan for queries taking more than this (works\n  # with SQLite, MySQL, and PostgreSQL)\n  # config.active_record.auto_explain_threshold_in_seconds = 0.5\nend\n"
  },
  {
    "path": "spec/dummy/config/environments/test.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb\n\n  # The test environment is used exclusively to run your application's\n  # test suite. You never need to work with it otherwise. Remember that\n  # your test database is \"scratch space\" for the test suite and is wiped\n  # and recreated between test runs. Don't rely on the data there!\n  config.cache_classes = true\n\n  # Do not eager load code on boot.\n  config.eager_load = false\n\n  # Configure static asset server for tests with Cache-Control for performance\n  config.serve_static_files = true\n  config.static_cache_control = \"public, max-age=3600\"\n\n  # Log error messages when you accidentally call methods on nil\n  config.whiny_nils = true\n\n  # Show full error reports and disable caching\n  config.consider_all_requests_local       = true\n  config.action_controller.perform_caching = false\n\n  # Raise exceptions instead of rendering exception templates\n  config.action_dispatch.show_exceptions = false\n\n  # Disable request forgery protection in test environment\n  config.action_controller.allow_forgery_protection    = false\n\n  # Tell Action Mailer not to deliver emails to the real world.\n  # The :test delivery method accumulates sent emails in the\n  # ActionMailer::Base.deliveries array.\n  config.action_mailer.delivery_method = :test\n\n  # Raise exception on mass assignment protection for Active Record models\n  # config.active_record.mass_assignment_sanitizer = :strict\n\n  # Print deprecation notices to the stderr\n  config.active_support.deprecation = :stderr\nend\n"
  },
  {
    "path": "spec/dummy/config/initializers/backtrace_silencers.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.\n# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }\n\n# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.\n# Rails.backtrace_cleaner.remove_silencers!\n"
  },
  {
    "path": "spec/dummy/config/initializers/inflections.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new inflection rules using the following format\n# (all these examples are active by default):\n# ActiveSupport::Inflector.inflections do |inflect|\n#   inflect.plural /^(ox)$/i, '\\1en'\n#   inflect.singular /^(ox)en/i, '\\1'\n#   inflect.irregular 'person', 'people'\n#   inflect.uncountable %w( fish sheep )\n# end\n#\n# These inflection rules are supported but not enabled by default:\n# ActiveSupport::Inflector.inflections do |inflect|\n#   inflect.acronym 'RESTful'\n# end\n"
  },
  {
    "path": "spec/dummy/config/initializers/mime_types.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new mime types for use in respond_to blocks:\n# Mime::Type.register \"text/richtext\", :rtf\n# Mime::Type.register_alias \"text/html\", :iphone\n"
  },
  {
    "path": "spec/dummy/config/initializers/secret_token.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Your secret key for verifying the integrity of signed cookies.\n# If you change this key, all old signed cookies will become invalid!\n# Make sure the secret is at least 30 characters and all random,\n# no regular words or you'll be exposed to dictionary attacks.\nDummy::Application.config.secret_token = '09c51ab7cd021c804bee0cfc280754db976151e77eaacc310923821bd9bbc1b649e67c9154616ee26e14df6861584ba1e845c24c65af32a54e979bb80cebacc3'\n"
  },
  {
    "path": "spec/dummy/config/initializers/session_store.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\nDummy::Application.config.session_store :cookie_store, key: '_dummy_session'\n\n# Use the database for sessions instead of the cookie-based default,\n# which shouldn't be used to store highly confidential information\n# (create the session table with \"rails generate session_migration\")\n# Dummy::Application.config.session_store :active_record_store\n"
  },
  {
    "path": "spec/dummy/config/initializers/wrap_parameters.rb",
    "content": "# Be sure to restart your server when you modify this file.\n#\n# This file contains settings for ActionController::ParamsWrapper which\n# is enabled by default.\n\n# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.\nActiveSupport.on_load(:action_controller) do\n  wrap_parameters format: [:json]\nend\n\n# Disable root element in JSON by default.\nActiveSupport.on_load(:active_record) do\n  self.include_root_in_json = false\nend\n"
  },
  {
    "path": "spec/dummy/config/locales/en.yml",
    "content": "# Sample localization file for English. Add more files in this directory for other locales.\n# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.\n\nen:\n  hello: \"Hello world\"\n"
  },
  {
    "path": "spec/dummy/config/routes.rb",
    "content": "Dummy::Application.routes.draw do\n  # The priority is based upon order of creation:\n  # first created -> highest priority.\n\n  # Sample of regular route:\n  #   match 'products/:id' => 'catalog#view'\n  # Keep in mind you can assign values other than :controller and :action\n\n  # Sample of named route:\n  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase\n  # This route can be invoked with purchase_url(:id => product.id)\n\n  # Sample resource route (maps HTTP verbs to controller actions automatically):\n  #   resources :products\n\n  # Sample resource route with options:\n  #   resources :products do\n  #     member do\n  #       get 'short'\n  #       post 'toggle'\n  #     end\n  #\n  #     collection do\n  #       get 'sold'\n  #     end\n  #   end\n\n  # Sample resource route with sub-resources:\n  #   resources :products do\n  #     resources :comments, :sales\n  #     resource :seller\n  #   end\n\n  # Sample resource route with more complex sub-resources\n  #   resources :products do\n  #     resources :comments\n  #     resources :sales do\n  #       get 'recent', :on => :collection\n  #     end\n  #   end\n\n  # Sample resource route within a namespace:\n  #   namespace :admin do\n  #     # Directs /admin/products/* to Admin::ProductsController\n  #     # (app/controllers/admin/products_controller.rb)\n  #     resources :products\n  #   end\n\n  # You can have the root of your site routed with \"root\"\n  # just remember to delete public/index.html.\n  # root :to => 'welcome#index'\n\n  # See how all your routes lay out with \"rake routes\"\n\n  # This is a legacy wild controller route that's not recommended for RESTful applications.\n  # Note: This route will make all actions in every controller accessible via GET requests.\n  # match ':controller(/:action(/:id))(.:format)'\nend\n"
  },
  {
    "path": "spec/dummy/config.ru",
    "content": "# This file is used by Rack-based servers to start the application.\n\nrequire ::File.expand_path('../config/environment',  __FILE__)\nrun Dummy::Application\n"
  },
  {
    "path": "spec/dummy/db/seeds.rb",
    "content": "# This file should contain all the record creation needed to seed the database with its default values.\n# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).\n#\n# Examples:\n#\n#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])\n#   Mayor.create(name: 'Emanuel', city: cities.first)\n"
  },
  {
    "path": "spec/dummy/doc/README_FOR_APP",
    "content": "Use this README file to introduce your application and point to useful places in the API for learning more.\nRun \"rake doc:app\" to generate API documentation for your models, controllers, helpers, and libraries.\n"
  },
  {
    "path": "spec/dummy/lib/assets/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/lib/tasks/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/log/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/public/404.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The page you were looking for doesn't exist (404)</title>\n  <style type=\"text/css\">\n    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }\n    div.dialog {\n      width: 25em;\n      padding: 0 4em;\n      margin: 4em auto 0 auto;\n      border: 1px solid #ccc;\n      border-right-color: #999;\n      border-bottom-color: #999;\n    }\n    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/404.html -->\n  <div class=\"dialog\">\n    <h1>The page you were looking for doesn't exist.</h1>\n    <p>You may have mistyped the address or the page may have moved.</p>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/422.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The change you wanted was rejected (422)</title>\n  <style type=\"text/css\">\n    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }\n    div.dialog {\n      width: 25em;\n      padding: 0 4em;\n      margin: 4em auto 0 auto;\n      border: 1px solid #ccc;\n      border-right-color: #999;\n      border-bottom-color: #999;\n    }\n    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/422.html -->\n  <div class=\"dialog\">\n    <h1>The change you wanted was rejected.</h1>\n    <p>Maybe you tried to change something you didn't have access to.</p>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/500.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>We're sorry, but something went wrong (500)</title>\n  <style type=\"text/css\">\n    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }\n    div.dialog {\n      width: 25em;\n      padding: 0 4em;\n      margin: 4em auto 0 auto;\n      border: 1px solid #ccc;\n      border-right-color: #999;\n      border-bottom-color: #999;\n    }\n    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/500.html -->\n  <div class=\"dialog\">\n    <h1>We're sorry, but something went wrong.</h1>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>Ruby on Rails: Welcome aboard</title>\n    <style type=\"text/css\" media=\"screen\">\n      body {\n        margin: 0;\n        margin-bottom: 25px;\n        padding: 0;\n        background-color: #f0f0f0;\n        font-family: \"Lucida Grande\", \"Bitstream Vera Sans\", \"Verdana\";\n        font-size: 13px;\n        color: #333;\n      }\n\n      h1 {\n        font-size: 28px;\n        color: #000;\n      }\n\n      a  {color: #03c}\n      a:hover {\n        background-color: #03c;\n        color: white;\n        text-decoration: none;\n      }\n\n\n      #page {\n        background-color: #f0f0f0;\n        width: 750px;\n        margin: 0;\n        margin-left: auto;\n        margin-right: auto;\n      }\n\n      #content {\n        float: left;\n        background-color: white;\n        border: 3px solid #aaa;\n        border-top: none;\n        padding: 25px;\n        width: 500px;\n      }\n\n      #sidebar {\n        float: right;\n        width: 175px;\n      }\n\n      #footer {\n        clear: both;\n      }\n\n      #header, #about, #getting-started {\n        padding-left: 75px;\n        padding-right: 30px;\n      }\n\n\n      #header {\n        background-image: url(\"assets/rails.png\");\n        background-repeat: no-repeat;\n        background-position: top left;\n        height: 64px;\n      }\n      #header h1, #header h2 {margin: 0}\n      #header h2 {\n        color: #888;\n        font-weight: normal;\n        font-size: 16px;\n      }\n\n\n      #about h3 {\n        margin: 0;\n        margin-bottom: 10px;\n        font-size: 14px;\n      }\n\n      #about-content {\n        background-color: #ffd;\n        border: 1px solid #fc0;\n        margin-left: -55px;\n        margin-right: -10px;\n      }\n      #about-content table {\n        margin-top: 10px;\n        margin-bottom: 10px;\n        font-size: 11px;\n        border-collapse: collapse;\n      }\n      #about-content td {\n        padding: 10px;\n        padding-top: 3px;\n        padding-bottom: 3px;\n      }\n      #about-content td.name  {color: #555}\n      #about-content td.value {color: #000}\n\n      #about-content ul {\n        padding: 0;\n        list-style-type: none;\n      }\n\n      #about-content.failure {\n        background-color: #fcc;\n        border: 1px solid #f00;\n      }\n      #about-content.failure p {\n        margin: 0;\n        padding: 10px;\n      }\n\n\n      #getting-started {\n        border-top: 1px solid #ccc;\n        margin-top: 25px;\n        padding-top: 15px;\n      }\n      #getting-started h1 {\n        margin: 0;\n        font-size: 20px;\n      }\n      #getting-started h2 {\n        margin: 0;\n        font-size: 14px;\n        font-weight: normal;\n        color: #333;\n        margin-bottom: 25px;\n      }\n      #getting-started ol {\n        margin-left: 0;\n        padding-left: 0;\n      }\n      #getting-started li {\n        font-size: 18px;\n        color: #888;\n        margin-bottom: 25px;\n      }\n      #getting-started li h2 {\n        margin: 0;\n        font-weight: normal;\n        font-size: 18px;\n        color: #333;\n      }\n      #getting-started li p {\n        color: #555;\n        font-size: 13px;\n      }\n\n\n      #sidebar ul {\n        margin-left: 0;\n        padding-left: 0;\n      }\n      #sidebar ul h3 {\n        margin-top: 25px;\n        font-size: 16px;\n        padding-bottom: 10px;\n        border-bottom: 1px solid #ccc;\n      }\n      #sidebar li {\n        list-style-type: none;\n      }\n      #sidebar ul.links li {\n        margin-bottom: 5px;\n      }\n\n      .filename {\n        font-style: italic;\n      }\n    </style>\n    <script type=\"text/javascript\">\n      function about() {\n        info = document.getElementById('about-content');\n        if (window.XMLHttpRequest)\n          { xhr = new XMLHttpRequest(); }\n        else\n          { xhr = new ActiveXObject(\"Microsoft.XMLHTTP\"); }\n        xhr.open(\"GET\",\"rails/info/properties\",false);\n        xhr.send(\"\");\n        info.innerHTML = xhr.responseText;\n        info.style.display = 'block'\n      }\n    </script>\n  </head>\n  <body>\n    <div id=\"page\">\n      <div id=\"sidebar\">\n        <ul id=\"sidebar-items\">\n          <li>\n            <h3>Browse the documentation</h3>\n            <ul class=\"links\">\n              <li><a href=\"http://guides.rubyonrails.org/\">Rails Guides</a></li>\n              <li><a href=\"http://api.rubyonrails.org/\">Rails API</a></li>\n              <li><a href=\"http://www.ruby-doc.org/core/\">Ruby core</a></li>\n              <li><a href=\"http://www.ruby-doc.org/stdlib/\">Ruby standard library</a></li>\n            </ul>\n          </li>\n        </ul>\n      </div>\n\n      <div id=\"content\">\n        <div id=\"header\">\n          <h1>Welcome aboard</h1>\n          <h2>You&rsquo;re riding Ruby on Rails!</h2>\n        </div>\n\n        <div id=\"about\">\n          <h3><a href=\"rails/info/properties\" onclick=\"about(); return false\">About your application&rsquo;s environment</a></h3>\n          <div id=\"about-content\" style=\"display: none\"></div>\n        </div>\n\n        <div id=\"getting-started\">\n          <h1>Getting started</h1>\n          <h2>Here&rsquo;s how to get rolling:</h2>\n\n          <ol>\n            <li>\n              <h2>Use <code>rails generate</code> to create your models and controllers</h2>\n              <p>To see all available options, run it without parameters.</p>\n            </li>\n\n            <li>\n              <h2>Set up a default route and remove <span class=\"filename\">public/index.html</span></h2>\n              <p>Routes are set up in <span class=\"filename\">config/routes.rb</span>.</p>\n            </li>\n\n            <li>\n              <h2>Create your database</h2>\n              <p>Run <code>rake db:create</code> to create your database. If you're not using SQLite (the default), edit <span class=\"filename\">config/database.yml</span> with your username and password.</p>\n            </li>\n          </ol>\n        </div>\n      </div>\n\n      <div id=\"footer\">&nbsp;</div>\n    </div>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/robots.txt",
    "content": "# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file\n#\n# To ban all spiders from the entire site uncomment the next two lines:\n# User-Agent: *\n# Disallow: /\n"
  },
  {
    "path": "spec/dummy/script/rails",
    "content": "#!/usr/bin/env ruby\n# This command will automatically be run when you run \"rails\" with Rails 3 gems installed from the root of your application.\n\nAPP_PATH = File.expand_path('../../config/application',  __FILE__)\nrequire File.expand_path('../../config/boot',  __FILE__)\nrequire 'rails/commands'\n"
  },
  {
    "path": "spec/dummy/test/fixtures/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/test/functional/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/test/integration/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/test/performance/browsing_test.rb",
    "content": "require 'test_helper'\nrequire 'rails/performance_test_help'\n\nclass BrowsingTest < ActionDispatch::PerformanceTest\n  # Refer to the documentation for all available options\n  # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]\n  #                          :output => 'tmp/performance', :formats => [:flat] }\n\n  def test_homepage\n    get '/'\n  end\nend\n"
  },
  {
    "path": "spec/dummy/test/test_helper.rb",
    "content": "ENV[\"RAILS_ENV\"] = \"test\"\nrequire File.expand_path('../../config/environment', __FILE__)\nrequire 'rails/test_help'\n\nclass ActiveSupport::TestCase\n  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.\n  #\n  # Note: You'll currently still have to declare fixtures explicitly in integration tests\n  # -- they do not yet inherit this setting\n  fixtures :all\n\n  # Add more helper methods to be used by all tests here...\nend\n"
  },
  {
    "path": "spec/dummy/test/unit/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/vendor/assets/javascripts/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/vendor/assets/stylesheets/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/dummy/vendor/plugins/.gitkeep",
    "content": ""
  },
  {
    "path": "spec/lib/mailgun_rails/attachment_spec.rb",
    "content": "require 'spec_helper'\nrequire 'mailgun_rails/attachment'\n\ndescribe MailgunRails::Attachment do\n  describe \"#send_message\" do\n    before do\n      @mail = Mail.new()\n      @mail.attachments[\"attachment.png\"] = \"\\312\\213\\254\\232\"\n      @mail.attachments.inline[\"attachment2.png\"] = \"\\312\\213\\254\\232\"\n      @mail.attachments[\"attachment.json\"] = { mime_type: 'application/json', content: {cool: 'json'}.to_json }\n\n    end\n\n    it 'should respond to rest_client api' do\n      attachment = MailgunRails::Attachment.new(@mail.attachments.first)\n      attachment.respond_to?(:path).should eq(true)\n      attachment.respond_to?(:original_filename).should eq(true)\n      attachment.respond_to?(:content_type).should eq(true)\n      attachment.respond_to?(:read).should eq(true)\n    end\n\n    it 'should set cid as original_filename' do\n      attachment = MailgunRails::Attachment.new(@mail.attachments.inline.first, inline: true)\n      attachment.original_filename.should eq(@mail.attachments.inline.first.cid)\n    end\n\n    it 'should set filename as original_filename' do\n      attachment = MailgunRails::Attachment.new(@mail.attachments.first)\n      attachment.original_filename.should eq(@mail.attachments.first.filename)\n    end\n\n    it 'should set filename as original_filename for hash' do\n      attachment = MailgunRails::Attachment.new(@mail.attachments.last)\n      attachment.original_filename.should eq(@mail.attachments.last.filename)\n    end\n  end\nend\n"
  },
  {
    "path": "spec/lib/mailgun_rails/client_spec.rb",
    "content": "require 'spec_helper'\nrequire 'mailgun_rails/client'\n\ndescribe MailgunRails::Client do\n  let(:client){MailgunRails::Client.new(:some_api_key, :some_domain)}\n\n  describe \"#send_message\" do\n    it 'should make a POST rest request passing the parameters to the mailgun end point' do\n      expected_url = \"https://api:some_api_key@api.mailgun.net/v3/some_domain/messages\"\n      RestClient::Request.stub(:execute).with({ method: :post, url: expected_url, payload: { foo: :bar }, verify_ssl: true})\n      client.send_message foo: :bar\n    end\n  end\nend\n"
  },
  {
    "path": "spec/lib/mailgun_rails/deliverer_spec.rb",
    "content": "require 'spec_helper'\nrequire 'mailgun_rails/deliverer'\nrequire 'mailgun_rails/client'\nrequire 'json'\n\n\ndescribe MailgunRails::Deliverer do\n  describe \"#deliver\" do\n    let(:api_key) { :some_api_key }\n    let(:domain) { :some_domain }\n    let(:mailgun_client) { double(MailgunRails::Client) }\n\n    before(:each) do\n      MailgunRails::Client.stub(:new).with(api_key, domain, true).and_return mailgun_client\n    end\n\n    it 'should invoke mailgun message transforming the basic email properties' do\n      check_mailgun_message basic_multipart_rails_message, basic_expected_mailgun_message\n    end\n\n    it 'should invoke mailgun message transforming the mail gun variables' do\n      check_mailgun_message message_with_mailgun_variables, basic_expected_mailgun_message.merge('v:foo' => 'bar')\n    end\n\n    it 'should invoke mailgun message transforming the mailgun options' do\n      check_mailgun_message message_with_mailgun_options, basic_expected_mailgun_message.merge('o:foo' => 'bar')\n    end\n\n    it 'should invoke mailgun message transforming the custom headers' do\n      check_mailgun_message message_with_custom_headers, basic_expected_mailgun_message.merge('h:foo' => 'bar')\n    end\n\n    it 'should invoke mailgun message transforming the recipient variables' do\n      check_mailgun_message message_with_mailgun_recipient_variables, basic_expected_mailgun_message.merge('recipient-variables' => {foo: 'bar'}.to_json)\n    end\n\n    it 'should send HTML only messages' do\n      check_mailgun_message html_rails_message, basic_expected_mailgun_message.except(:text)\n    end\n\n    it 'should send text only messages' do\n      check_mailgun_message text_rails_message, basic_expected_mailgun_message.except(:html)\n    end\n\n    it 'should include sender and recipient names in from field' do\n      check_mailgun_message text_rails_message_with_names, basic_expected_mailgun_message.except(:html).merge(emails_with_names)\n    end\n\n    it \"should not include cc if empty array\" do\n      msg = Mail::Message.new(to: 'to@email.com',\n                              from: 'from@email.com',\n                              cc: [])\n      expectation = { to: ['to@email.com'],\n                      from: ['from@email.com'] }\n      check_mailgun_message msg, expectation\n    end\n\n    it \"should include cc if present\" do\n      msg = Mail::Message.new(to: 'to@email.com',\n                              from: 'from@email.com',\n                              cc: 'cc@email.com')\n      expectation = { to: ['to@email.com'],\n                      from: ['from@email.com'],\n                      cc: ['cc@email.com'] }\n      check_mailgun_message msg, expectation\n    end\n\n    it \"should include bcc if present\" do\n      msg = Mail::Message.new(to: 'to@email.com',\n                              from: 'from@email.com',\n                              bcc: 'bcc@email.com')\n      expectation = { to: ['to@email.com'],\n                      from: ['from@email.com'],\n                      bcc: ['bcc@email.com'] }\n      check_mailgun_message msg, expectation\n    end\n\n    it 'should include reply-to name in custom header' do\n      msg = Mail::Message.new(to: 'to@email.com',\n                              from: 'from@email.com',\n                              reply_to: 'Reply User <replyto@email.com>')\n      expectation = { to: ['to@email.com'],\n                      from: ['from@email.com'],\n                      'h:Reply-To' => 'Reply User <replyto@email.com>' }\n      check_mailgun_message msg, expectation\n    end\n\n\n    it 'should include attachment' do\n      rails_message = rails_message_with_attachment\n      attachment = double(MailgunRails::Attachment)\n      MailgunRails::Attachment.stub(:new).with(rails_message.attachments.first, encoding: 'ascii-8bit').and_return attachment\n      expectation = basic_expected_mailgun_message\n      expectation[:attachment] = [attachment]\n      check_mailgun_message rails_message, expectation\n    end\n\n    it 'should include inline attachment' do\n      rails_message = rails_message_with_inline_attachment\n      attachment = double(MailgunRails::Attachment)\n      MailgunRails::Attachment.stub(:new).with(rails_message.attachments.first, encoding: 'ascii-8bit', inline: true).and_return attachment\n      expectation = basic_expected_mailgun_message\n      expectation[:inline] = [attachment]\n      check_mailgun_message rails_message, expectation\n    end\n\n    it 'should include attachment of both types' do\n      rails_message = rails_message_with_both_types_attachments\n      attachment = double(MailgunRails::Attachment)\n      MailgunRails::Attachment.stub(:new).with(rails_message.attachments.first, encoding: 'ascii-8bit', inline: true).and_return attachment\n      MailgunRails::Attachment.stub(:new).with(rails_message.attachments.last, encoding: 'ascii-8bit').and_return attachment\n      expectation = basic_expected_mailgun_message\n      expectation[:inline] = [attachment]\n      expectation[:attachment] = [attachment]\n      check_mailgun_message rails_message, expectation\n    end\n\n    it \"should update the Mail::Message#message_id with the id returned from mailgun\" do\n      msg = Mail::Message.new(to: 'to@email.com', from: 'from@email.com')\n      expectation = { to: ['to@email.com'], from: ['from@email.com']}\n      check_mailgun_message msg, expectation\n      msg.message_id.should eq \"20111114174239.25659.5817@samples.mailgun.org\"\n    end\n\n    def check_mailgun_message(rails_message, mailgun_message)\n      rest_response = double(:code => 200, :to_str => '{\"message\": \"Queued. Thank you.\",\"id\": \"<20111114174239.25659.5817@samples.mailgun.org>\"}')\n      mailgun_client.should_receive(:send_message).with(mailgun_message).and_return(rest_response)\n      MailgunRails::Deliverer.new(api_key: api_key, domain: domain).deliver!(rails_message)\n    end\n\n    def rails_message_with_attachment\n      msg = basic_multipart_rails_message\n      msg.attachments[\"attachment.jpg\"] = \"\\312\\213\\254\\232\"\n      msg\n    end\n\n    def rails_message_with_inline_attachment\n      msg = basic_multipart_rails_message\n      msg.attachments.inline[\"attachment.jpg\"] = \"\\312\\213\\254\\232\"\n      msg\n    end\n\n    def rails_message_with_both_types_attachments\n      msg = basic_multipart_rails_message\n      msg.attachments.inline[\"attachment.jpg\"] = \"\\312\\213\\254\\232\"\n      msg.attachments[\"attachment.png\"] = \"\\312\\213\\254\\232\"\n      msg\n    end\n\n    def basic_multipart_rails_message\n      this_example = self\n      Mail::Message.new(common_rails_message_properties.merge(content_type: 'multipart/alternative')) do\n        html_part do\n          body this_example.html_body\n        end\n\n        text_part do\n          body this_example.text_body\n        end\n      end\n    end\n\n    def html_rails_message\n      Mail::Message.new(common_rails_message_properties.merge(content_type: 'text/html', body: html_body))\n    end\n\n    def text_rails_message\n      Mail::Message.new(common_rails_message_properties.merge(content_type: 'text/plain', body: text_body))\n    end\n\n    def text_rails_message_with_names\n      Mail::Message.new(common_rails_message_properties.merge(content_type: 'text/plain', body: text_body).merge(emails_with_names))\n    end\n\n    def emails_with_names\n      {from: ['Sender <from@email.com>'], to: ['Receiver <to@email.com>', 'Another one <to2@email.com>']}\n    end\n\n    def common_rails_message_properties\n      {from: 'from@email.com', to: 'to@email.com', subject: 'some subject', reply_to: 'reply@to.com', }\n    end\n\n    def message_with_mailgun_variables\n      message = basic_multipart_rails_message\n      message.mailgun_variables = {foo: 'bar'}\n      message\n    end\n\n    def message_with_mailgun_options\n      message = basic_multipart_rails_message\n      message.mailgun_options = {foo: 'bar'}\n      message\n    end\n\n    def message_with_custom_headers\n      message = basic_multipart_rails_message\n      message.mailgun_headers = {foo: 'bar'}\n      message\n    end\n\n    def message_with_mailgun_recipient_variables\n      message = basic_multipart_rails_message\n      message.mailgun_recipient_variables = {foo: 'bar'}\n      message\n    end\n\n    def basic_expected_mailgun_message\n      {\n          :from => [common_rails_message_properties[:from]],\n          :to => [common_rails_message_properties[:to]],\n          :subject => common_rails_message_properties[:subject],\n          'h:Reply-To' => common_rails_message_properties[:reply_to],\n          :text => text_body,\n          :html => html_body\n      }\n    end\n  end\n\n  def html_body\n    '<span>the html content</span>'\n  end\n\n  def text_body\n    'the text content'\n  end\nend\n"
  },
  {
    "path": "spec/spec_helper.rb",
    "content": "# This file was generated by the `rspec --init` command. Conventionally, all\n# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.\n# Require this file using `require \"spec_helper\"` to ensure that it is only\n# loaded once.\n#\n# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration\n\nrequire 'mailgun_rails/mail_ext'\n\nrequire 'action_mailer'\n\nrequire File.expand_path(\"../dummy/config/environment.rb\",  __FILE__)\n\nRSpec.configure do |config|\n\n  config.treat_symbols_as_metadata_keys_with_true_values = true\n  config.run_all_when_everything_filtered = true\n  config.filter_run :focus\n\n  # Run specs in random order to surface order dependencies. If you find an\n  # order dependency and want to debug it, you can fix the order by providing\n  # the seed, which is printed after each run.\n  #     --seed 1234\n  config.order = 'random'\nend\n"
  }
]