chargify_api_ares 0.6.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.travis.yml +4 -4
 - data/Gemfile.lock +1 -1
 - data/HISTORY.md +34 -0
 - data/README.md +61 -44
 - data/chargify_api_ares.gemspec +3 -3
 - data/examples/charges.rb +33 -0
 - data/examples/coupons.rb +1 -1
 - data/examples/migrations.rb +30 -0
 - data/examples/subscriptions.rb +4 -3
 - data/lib/chargify_api_ares.rb +2 -0
 - data/lib/chargify_api_ares/resources/charge.rb +5 -0
 - data/lib/chargify_api_ares/resources/migration.rb +43 -0
 - data/lib/chargify_api_ares/resources/subscription.rb +2 -2
 - data/spec/remote/remote_spec.rb +139 -0
 - data/spec/resources/charge_spec.rb +18 -0
 - data/spec/resources/migration_preview_spec.rb +20 -0
 - data/spec/resources/migration_spec.rb +20 -0
 - data/spec/resources/subscription_spec.rb +5 -4
 - metadata +20 -33
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 603c7ec312d18a99d9cce9e2f9f0e863afbce583
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fe3b1ee31a4d5f14dffdc98cd953b4d68dfd0869
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b824586396ae701bc6f06731bec1f146733184089af858803a83cdb6ed647fcbadf7d4cbd21e27aa43da13c3dea43a81fab15fe5762756752f92346c2a104d25
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 96f8f56782d5d83344de9a0ec73e59cb78cebd6f78fa6ec5a38bf01b014a09af204e4f7ff317ffc1f6a161a30b79782437e6dc247fa316c362cefbce4bd82383
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/HISTORY.md
    ADDED
    
    | 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 1.0.0 / Nov 19 2013
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ### Backwards-incompatible changes
         
     | 
| 
      
 4 
     | 
    
         
            +
            * `Chargify::Subscription.charge` now returns an ActiveResource `Charge` object. In the case of an error, the `Charge` object will have `errors`, and you will not have to rescue an HTTP `422`.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            * Adds new `Chargify::Migration` and `Chargify::Migration::Preview` resources. These can be used as follows:
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 9 
     | 
    
         
            +
            subscription = Chargify::Subscription.find_by_customer_reference('marky-mark')
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # Chargify::Migration
         
     | 
| 
      
 12 
     | 
    
         
            +
            migration = subscription.migrate(:product_handle => "basic-plan")
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            migration = Chargify::Migration.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            # Chargify::Migration::Preview
         
     | 
| 
      
 17 
     | 
    
         
            +
            preview = Chargify::Migration::Preview.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            preview = Chargify::Migration.preview(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 20 
     | 
    
         
            +
            ```
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Error handling looks like:
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 25 
     | 
    
         
            +
            migration = subscription.migrate(:product_handle => "non-existent-plan")
         
     | 
| 
      
 26 
     | 
    
         
            +
            migration.errors.full_messages
         
     | 
| 
      
 27 
     | 
    
         
            +
            # => ["Invalid Product"]
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            preview = Chargify::Migration.preview(:subscription_id => subscription.id, :product_handle => "non-existent-plan")
         
     | 
| 
      
 30 
     | 
    
         
            +
            preview.errors.full_messages
         
     | 
| 
      
 31 
     | 
    
         
            +
            # => ["Product must be specified"]
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            See `examples/migrations.rb` and specs for more details.
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,15 +2,48 @@ Chargify API wrapper for Ruby (using ActiveResource) 
     | 
|
| 
       2 
2 
     | 
    
         
             
            ====================================================
         
     | 
| 
       3 
3 
     | 
    
         
             
            [](http://travis-ci.org/chargify/chargify_api_ares)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            **Note:** we have bumped to v1.0.0 to indicate a backwards incompatible change to the responses from `Chargify::Subscription.charge` and `Chargify::Subscription.migrate`.  Please see the HISTORY.md for more information.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       5 
7 
     | 
    
         
             
            **Please see important compatibility information at the bottom of this file.**
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            This is a Ruby wrapper for the [Chargify](http://chargify.com) API that leverages ActiveResource.
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            ### Installation
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This library can be installed as a gem. It is hosted on [Rubygems](http://rubygems.org).
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            You can install this library as a gem using the following command:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ``` bash
         
     | 
| 
      
 18 
     | 
    
         
            +
            $ gem install chargify_api_ares
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ### Usage
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Simply require this library before you use it:
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 26 
     | 
    
         
            +
            require 'chargify_api_ares'
         
     | 
| 
      
 27 
     | 
    
         
            +
            ```
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            If you're using Rails 3.x, you could include this gem in your Gemfile.
         
     | 
| 
      
 30 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 31 
     | 
    
         
            +
            gem 'chargify_api_ares'
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            Install the gem using the following command:
         
     | 
| 
      
 35 
     | 
    
         
            +
            $ bundle install
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            If you're using Rails 2 you could include this gem in your configuration, i.e. in `environment.rb`
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 40 
     | 
    
         
            +
            config.gem 'chargify_api_ares'
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       9 
43 
     | 
    
         
             
            To configure api key, site, domain, and protocol you can do the
         
     | 
| 
       10 
44 
     | 
    
         
             
            following. Please note that this step is required.
         
     | 
| 
       11 
45 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            Most common usage
         
     | 
| 
       13 
     | 
    
         
            -
            ----------------
         
     | 
| 
      
 46 
     | 
    
         
            +
            #### Most common usage
         
     | 
| 
       14 
47 
     | 
    
         | 
| 
       15 
48 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       16 
49 
     | 
    
         
             
              Chargify.configure do |c|
         
     | 
| 
         @@ -19,8 +52,7 @@ Most common usage 
     | 
|
| 
       19 
52 
     | 
    
         
             
              end
         
     | 
| 
       20 
53 
     | 
    
         
             
            ```
         
     | 
| 
       21 
54 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
            Overriding the endpoint
         
     | 
| 
       23 
     | 
    
         
            -
            --------------
         
     | 
| 
      
 55 
     | 
    
         
            +
            #### Overriding the endpoint
         
     | 
| 
       24 
56 
     | 
    
         | 
| 
       25 
57 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       26 
58 
     | 
    
         
             
              Chargify.configure do |c|
         
     | 
| 
         @@ -29,8 +61,7 @@ Overriding the endpoint 
     | 
|
| 
       29 
61 
     | 
    
         
             
              end
         
     | 
| 
       30 
62 
     | 
    
         
             
            ```
         
     | 
| 
       31 
63 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
            Available configuration options
         
     | 
| 
       33 
     | 
    
         
            -
            -------------------------------
         
     | 
| 
      
 64 
     | 
    
         
            +
            ### Available configuration options
         
     | 
| 
       34 
65 
     | 
    
         | 
| 
       35 
66 
     | 
    
         
             
            | Name              | Description                                                                                      | Default      | Required                   |
         
     | 
| 
       36 
67 
     | 
    
         
             
            | ----------------- | -----------------------------------------------------------------------------------              | ---------    | -------------------------- |
         
     | 
| 
         @@ -42,6 +73,12 @@ Available configuration options 
     | 
|
| 
       42 
73 
     | 
    
         
             
            | format            | The format of the request and response type that you want to deal with                           | xml          | No                         |
         
     | 
| 
       43 
74 
     | 
    
         
             
            | timeout           | The time in seconds for a request to be valid. Will raise a timeout error if exceeds time limit. | N/A          | No                         |
         
     | 
| 
       44 
75 
     | 
    
         | 
| 
      
 76 
     | 
    
         
            +
            Now you'll have access to classes the interact with the Chargify API, such as:
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            * `Chargify::Product`  
         
     | 
| 
      
 79 
     | 
    
         
            +
            * `Chargify::Customer`  
         
     | 
| 
      
 80 
     | 
    
         
            +
            * `Chargify::Subscription`
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       45 
82 
     | 
    
         
             
            It allows you to interface with the Chargify API using simple ActiveRecord-like syntax, i.e.:
         
     | 
| 
       46 
83 
     | 
    
         | 
| 
       47 
84 
     | 
    
         
             
            ``` ruby
         
     | 
| 
         @@ -63,44 +100,6 @@ subscription.save 
     | 
|
| 
       63 
100 
     | 
    
         
             
            subscription.cancel
         
     | 
| 
       64 
101 
     | 
    
         
             
            ```
         
     | 
| 
       65 
102 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
            See the `examples` directory for more usage examples.
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
            ### Installation
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
            This library can be installed as a gem. It is hosted on [Rubygems](http://rubygems.org).
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
            You can install this library as a gem using the following command:
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
            $ gem install chargify_api_ares
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
            ### Usage
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
            Simply require this library before you use it:
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
            ``` ruby
         
     | 
| 
       81 
     | 
    
         
            -
            require 'chargify_api_ares'
         
     | 
| 
       82 
     | 
    
         
            -
            ```
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
            If you're using Rails 3.x, you could include this gem in your Gemfile.
         
     | 
| 
       85 
     | 
    
         
            -
            ``` ruby
         
     | 
| 
       86 
     | 
    
         
            -
            gem 'chargify_api_ares'
         
     | 
| 
       87 
     | 
    
         
            -
            ```
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
            Install the gem using the following command:
         
     | 
| 
       90 
     | 
    
         
            -
            $ bundle install
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
            If you're using Rails 2 you could include this gem in your configuration, i.e. in `environment.rb`
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
            ``` ruby
         
     | 
| 
       95 
     | 
    
         
            -
            config.gem 'chargify_api_ares'
         
     | 
| 
       96 
     | 
    
         
            -
            ```
         
     | 
| 
       97 
     | 
    
         
            -
                
         
     | 
| 
       98 
     | 
    
         
            -
            Now you'll have access to classes the interact with the Chargify API, such as:
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
            * `Chargify::Product`  
         
     | 
| 
       101 
     | 
    
         
            -
            * `Chargify::Customer`  
         
     | 
| 
       102 
     | 
    
         
            -
            * `Chargify::Subscription`
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
103 
     | 
    
         
             
            Check out the examples in the `examples` directory.  If you're not familiar with how ActiveResource works, you may be interested in some [ActiveResource Documentation](http://apidock.com/rails/ActiveResource/Base)
         
     | 
| 
       105 
104 
     | 
    
         | 
| 
       106 
105 
     | 
    
         
             
            ### Compatibility
         
     | 
| 
         @@ -143,3 +142,21 @@ requests will be rejected. 
     | 
|
| 
       143 
142 
     | 
    
         
             
            Version 0.6.x of this gem will attempt to patch your ActiveModel if you
         
     | 
| 
       144 
143 
     | 
    
         
             
            have an incompatible version.  To avoid this patch, you should use
         
     | 
| 
       145 
144 
     | 
    
         
             
            3.0.20 or higher of ActiveResource.
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            ### Contributing
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            * Check out the latest master to make sure the feature hasn't been
         
     | 
| 
      
 149 
     | 
    
         
            +
              implemented or the bug hasn't been fixed yet
         
     | 
| 
      
 150 
     | 
    
         
            +
            * Check out the [issue
         
     | 
| 
      
 151 
     | 
    
         
            +
              tracker](http://github.com/chargify/chargify_api_ares/issues) to make
         
     | 
| 
      
 152 
     | 
    
         
            +
            sure someone already hasn't requested it and/or contributed it
         
     | 
| 
      
 153 
     | 
    
         
            +
            * Fork the project
         
     | 
| 
      
 154 
     | 
    
         
            +
            * Start a feature/bugfix branch
         
     | 
| 
      
 155 
     | 
    
         
            +
            * Commit and push until you are happy with your contribution
         
     | 
| 
      
 156 
     | 
    
         
            +
            * Make sure to add tests for the feature/bugfix
         
     | 
| 
      
 157 
     | 
    
         
            +
            * Please squash your commits.
         
     | 
| 
      
 158 
     | 
    
         
            +
            * Please try not to mess with the Rakefile, version, or history. If you
         
     | 
| 
      
 159 
     | 
    
         
            +
              want to have your own version, or is otherwise necessary, that is
         
     | 
| 
      
 160 
     | 
    
         
            +
            fine, but please isolate it to its own commit so we can cherry-pick
         
     | 
| 
      
 161 
     | 
    
         
            +
            around it.
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
    
        data/chargify_api_ares.gemspec
    CHANGED
    
    | 
         @@ -4,11 +4,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       4 
4 
     | 
    
         
             
              s.rubygems_version = '1.3.7'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              s.name    = 'chargify_api_ares'
         
     | 
| 
       7 
     | 
    
         
            -
              s.version = '0. 
     | 
| 
       8 
     | 
    
         
            -
              s.date    = '2013- 
     | 
| 
      
 7 
     | 
    
         
            +
              s.version = '1.0.0'
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.date    = '2013-11-19'
         
     | 
| 
       9 
9 
     | 
    
         
             
              s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.description = ''
         
     | 
| 
       11 
     | 
    
         
            -
              s.authors = ["Michael Klett", "Nathan Verni", "Graham McIntire", "Jeremy W. Rowe", "Rodrigo Franco", "Shay Frendt"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.authors = ["Michael Klett", "Nathan Verni", "Graham McIntire", "Jeremy W. Rowe", "Rodrigo Franco", "Shay Frendt", "Eric Farkas"]
         
     | 
| 
       12 
12 
     | 
    
         
             
              s.email = 'support@chargify.com'
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.homepage = 'http://github.com/chargify/chargify_api_ares'
         
     | 
| 
       14 
14 
     | 
    
         | 
    
        data/examples/charges.rb
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'chargify_api_ares'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            # You could load your credentials from a file...
         
     | 
| 
      
 6 
     | 
    
         
            +
            chargify_config = YAML::load_file(File.join(File.dirname(__FILE__), '..', 'chargify.yml'))
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Chargify.configure do |c|
         
     | 
| 
      
 9 
     | 
    
         
            +
              c.subdomain = chargify_config['subdomain']
         
     | 
| 
      
 10 
     | 
    
         
            +
              c.api_key   = chargify_config['api_key']
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            # Lookup up existing Subscription using the Customer's reference
         
     | 
| 
      
 14 
     | 
    
         
            +
            subscription = Subscription.find_by_customer_reference('moklett')
         
     | 
| 
      
 15 
     | 
    
         
            +
            # => #<Chargify::Subscription:0x1020ed4b0 @prefix_options={}, @attributes={"cancellation_message"=>nil, "activated_at"=>Tue Nov 17 16:00:17 UTC 2009, "expires_at"=>nil, "updated_at"=>Tue Nov 17 16:00:17 UTC 2009, "credit_card"=>#<Chargify::Subscription::CreditCard:0x102046b10 @prefix_options={}, @attributes={"card_type"=>"bogus", "expiration_year"=>2020, "masked_card_number"=>"XXXX-XXXX-XXXX-1", "first_name"=>"Michael", "expiration_month"=>1, "last_name"=>"Klett"}>, "product"=>#<Chargify::Product:0x10204a2d8 @prefix_options={}, @attributes={"price_in_cents"=>0, "name"=>"Chargify API Ares Test", "handle"=>"chargify-api-ares-test", "product_family"=>#<Chargify::Product::ProductFamily:0x1020490b8 @prefix_options={}, @attributes={"name"=>"Chargify API ARes Test", "handle"=>"chargify-api-ares-test", "id"=>79, "accounting_code"=>nil}>, "id"=>153, "accounting_code"=>nil, "interval_unit"=>"month", "interval"=>1}>, "trial_ended_at"=>nil, "id"=>331, "current_period_ends_at"=>Thu Dec 17 16:00:17 UTC 2009, "product_handle"=>"chargify-api-ares-test", "trial_started_at"=>nil, "customer"=>#<Chargify::Customer:0x10204b688 @prefix_options={}, @attributes={"reference"=>"moklett", "updated_at"=>Tue Nov 17 15:51:02 UTC 2009, "id"=>331, "first_name"=>"Michael", "organization"=>"Chargify", "last_name"=>"Klett", "email"=>"moklett@example.com", "created_at"=>Tue Nov 17 15:51:02 UTC 2009}>, "balance_in_cents"=>0, "current_period_started_at"=>Tue Nov 17 16:00:17 UTC 2009, "state"=>"active", "created_at"=>Tue Nov 17 16:00:17 UTC 2009, "customer_reference"=>"moklett"}>
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            # Perform a one-time charge against this subscription
         
     | 
| 
      
 18 
     | 
    
         
            +
            Chargify::Charge.create(:subscription_id => subscription.id, :amount => 10.00, :memo => 'Extra service')
         
     | 
| 
      
 19 
     | 
    
         
            +
            # => #<Chargify::Charge:0x007f80da97b6b8 @attributes={"amount"=>10.00, "memo"=>"Extra service", "id"=>43382, "amount_in_cents"=>1000, "component_id"=>nil, "created_at"=>2013-11-08 21:16:03 UTC, "ending_balance_in_cents"=>1000, "kind"=>"one_time", "payment_id"=>4383, "product_id"=>153, "starting_balance_in_cents"=>0, "success"=>true, "tax_id"=>nil, "type"=>"Charge", "transaction_type"=>"charge", "gateway_transaction_id"=>nil, "statement_id"=>25695, "customer_id"=>40210}, @prefix_options={:subscription_id=>416940}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f80da97b0f0 @base=#<Chargify::Charge:0x007f80da97b6b8 ...>, @messages={}>>
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            # If a charge fails
         
     | 
| 
      
 22 
     | 
    
         
            +
            charge = Chargify::Charge.create(:subscription_id => subscription.id, :amount => 10.00, :memo =>'Extra service')
         
     | 
| 
      
 23 
     | 
    
         
            +
            # => #<Chargify::Charge:0x007f80dcc9f428 @attributes={"amount"=>10.0, "memo"=>"Extra service"}, @prefix_options={:subscription_id=>41630}, @persisted=false, @remote_errors=#<ActiveResource::ResourceInvalid: Failed.  Response code = 422.  Response message = Unprocessable Entity.>, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f80dcc9f0b8 @base=#<Chargify::Charge:0x007f80dcc9f428 ...>, @messages={:base=>["Bogus Gateway: Forced failure"]}>>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            charge.valid?
         
     | 
| 
      
 26 
     | 
    
         
            +
            # => false
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            charge.errors.full_messages
         
     | 
| 
      
 29 
     | 
    
         
            +
            # => ["Bogus Gateway: Forced failure"]
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            # Or call 'charge' right on the subscription
         
     | 
| 
      
 32 
     | 
    
         
            +
            subscription.charge(:amount => 10.00, :memo => 'Extra service')
         
     | 
| 
      
 33 
     | 
    
         
            +
            # => #<Chargify::Charge:0x007f80da97b6b8 @attributes={"amount"=>10.00, "memo"=>"Extra service", "id"=>4313282, "amount_in_cents"=>1000, "component_id"=>nil, "created_at"=>2013-11-08 21:16:03 UTC, "ending_balance_in_cents"=>1000, "kind"=>"one_time", "payment_id"=>43303, "product_id"=>153, "starting_balance_in_cents"=>0, "success"=>true, "tax_id"=>nil, "type"=>"Charge", "transaction_type"=>"charge", "gateway_transaction_id"=>nil, "statement_id"=>25695, "customer_id"=>48210}, @prefix_options={:subscription_id=>41690}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f80da97b0f0 @base=#<Chargify::Charge:0x007f80da97b6b8 ...>, @messages={}>>
         
     | 
    
        data/examples/coupons.rb
    CHANGED
    
    | 
         @@ -22,7 +22,7 @@ coupon = Chargify::Coupon.create( 
     | 
|
| 
       22 
22 
     | 
    
         
             
            )
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
            # Lookup up existing coupon using the product_family_id and the coupon code
         
     | 
| 
       25 
     | 
    
         
            -
            coupon = Chargify:: 
     | 
| 
      
 25 
     | 
    
         
            +
            coupon = Chargify::Coupon.find_by_product_family_id_and_code(2,"10OFF")
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            # Looking up all coupons for a product family
         
     | 
| 
       28 
28 
     | 
    
         
             
            coupons = Chargify::Coupon.find_all_by_product_family_id(12345)
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'chargify_api_ares'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            # You could load your credentials from a file...
         
     | 
| 
      
 6 
     | 
    
         
            +
            chargify_config = YAML::load_file(File.join(File.dirname(__FILE__), '..', 'chargify.yml'))
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Chargify.configure do |c|
         
     | 
| 
      
 9 
     | 
    
         
            +
              c.subdomain = chargify_config['subdomain']
         
     | 
| 
      
 10 
     | 
    
         
            +
              c.api_key   = chargify_config['api_key']
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            # Lookup up existing Subscription using the Customer's reference
         
     | 
| 
      
 14 
     | 
    
         
            +
            subscription = Subscription.find_by_customer_reference('marky-mark')
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            # Migrate the subscription to a new product
         
     | 
| 
      
 17 
     | 
    
         
            +
            subscription.migrate(:product_handle => "basic-plan")
         
     | 
| 
      
 18 
     | 
    
         
            +
            # => #<Chargify::Migration:0x007fe656ab4430 @attributes={"product_id"=>20, "id"=>518, "activated_at"=>2013-11-11 20:42:57 UTC, "balance_in_cents"=>-7499, "cancel_at_end_of_period"=>false, "canceled_at"=>nil, "cancellation_message"=>nil, "created_at"=>2013-11-11 20:42:55 UTC, "current_period_ends_at"=>2013-12-12 03:54:21 UTC, "expires_at"=>nil, "next_assessment_at"=>2013-12-12 03:54:21 UTC, "payment_collection_method"=>"automatic", "state"=>"active", "trial_ended_at"=>nil, "trial_started_at"=>nil, "updated_at"=>2013-11-12 03:54:21 UTC, "current_period_started_at"=>2013-11-12 03:54:21 UTC, "previous_state"=>"active", "signup_payment_id"=>2029, "signup_revenue"=>"99.00", "delayed_cancel_at"=>nil, "coupon_code"=>nil, "total_revenue_in_cents"=>10001, "product_price_in_cents"=>2400, "product_version_number"=>2, "customer"=>#<Chargify::Customer:0x007fe656977ea0 @attributes={"address"=>nil, "address_2"=>nil, "city"=>nil, "country"=>nil, "created_at"=>2013-11-11 20:42:35 UTC, "email"=>"marky@example.com", "first_name"=>"Marky ", "id"=>518, "last_name"=>"Mark", "organization"=>nil, "phone"=>nil, "reference"=>"marky-mark", "state"=>nil, "updated_at"=>2013-11-11 20:42:35 UTC, "zip"=>nil}, @prefix_options={}, @persisted=false>, "product"=>#<Chargify::Product:0x007fe656976910 @attributes={"accounting_code"=>nil, "archived_at"=>nil, "created_at"=>2013-11-09 20:00:59 UTC, "description"=>"Eos quam veritatis quo iste et.  Quaerat dolor suscipit explicabo et sit.  Nostrum dolor commodi voluptatum similique et facere accusamus.", "expiration_interval"=>nil, "expiration_interval_unit"=>"never", "handle"=>"basic-plan", "id"=>20, "initial_charge_in_cents"=>nil, "interval"=>1, "interval_unit"=>"month", "name"=>"Basic", "price_in_cents"=>2400, "request_credit_card"=>true, "require_credit_card"=>true, "return_params"=>nil, "return_url"=>nil, "trial_interval"=>1, "trial_interval_unit"=>"month", "trial_price_in_cents"=>0, "update_return_url"=>nil, "updated_at"=>2013-11-12 03:51:18 UTC, "product_family"=>#<Chargify::ProductFamily:0x007fe6569749f8 @attributes={"accounting_code"=>nil, "description"=>nil, "handle"=>"acme-online", "id"=>3, "name"=>"Acme Online"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=false>, "credit_card"=>#<Chargify::Migration::CreditCard:0x007fe65696de78 @attributes={"type"=>"PaymentProfile", "billing_address"=>nil, "billing_address_2"=>nil, "billing_city"=>nil, "billing_country"=>nil, "billing_state"=>nil, "billing_zip"=>nil, "card_type"=>"bogus", "current_vault"=>"bogus", "customer_id"=>518, "customer_vault_token"=>nil, "expiration_month"=>1, "expiration_year"=>2023, "first_name"=>"Marky", "id"=>518, "last_name"=>"Mark", "masked_card_number"=>"XXXX-XXXX-XXXX-1", "vault_token"=>"1"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007fe656aafd18 @base=#<Chargify::Migration:0x007fe656ab4430 ...>, @messages={}>>
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            # Another way to migrate a subscription to a new product
         
     | 
| 
      
 21 
     | 
    
         
            +
            Migration.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 22 
     | 
    
         
            +
            # => #<Chargify::Migration:0x007fe656cc8b90 @attributes={"product_id"=>20, "id"=>518, "activated_at"=>2013-11-11 20:42:57 UTC, "balance_in_cents"=>-7499, "cancel_at_end_of_period"=>false, "canceled_at"=>nil, "cancellation_message"=>nil, "created_at"=>2013-11-11 20:42:55 UTC, "current_period_ends_at"=>2013-12-12 03:53:10 UTC, "expires_at"=>nil, "next_assessment_at"=>2013-12-12 03:53:10 UTC, "payment_collection_method"=>"automatic", "state"=>"active", "trial_ended_at"=>nil, "trial_started_at"=>nil, "updated_at"=>2013-11-12 03:53:10 UTC, "current_period_started_at"=>2013-11-12 03:53:09 UTC, "previous_state"=>"active", "signup_payment_id"=>2029, "signup_revenue"=>"99.00", "delayed_cancel_at"=>nil, "coupon_code"=>nil, "total_revenue_in_cents"=>9999, "product_price_in_cents"=>2400, "product_version_number"=>2, "customer"=>#<Chargify::Customer:0x007fe6548fdbc0 @attributes={"address"=>nil, "address_2"=>nil, "city"=>nil, "country"=>nil, "created_at"=>2013-11-11 20:42:35 UTC, "email"=>"marky@example.com", "first_name"=>"Marky ", "id"=>518, "last_name"=>"Mark", "organization"=>nil, "phone"=>nil, "reference"=>"marky-mark", "state"=>nil, "updated_at"=>2013-11-11 20:42:35 UTC, "zip"=>nil}, @prefix_options={}, @persisted=false>, "product"=>#<Chargify::Product:0x007fe6548fc608 @attributes={"accounting_code"=>nil, "archived_at"=>nil, "created_at"=>2013-11-09 20:00:59 UTC, "description"=>"Eos quam veritatis quo iste et.  Quaerat dolor suscipit explicabo et sit.  Nostrum dolor commodi voluptatum similique et facere accusamus.", "expiration_interval"=>nil, "expiration_interval_unit"=>"never", "handle"=>"basic-plan", "id"=>20, "initial_charge_in_cents"=>nil, "interval"=>1, "interval_unit"=>"month", "name"=>"Basic", "price_in_cents"=>2400, "request_credit_card"=>true, "require_credit_card"=>true, "return_params"=>nil, "return_url"=>nil, "trial_interval"=>1, "trial_interval_unit"=>"month", "trial_price_in_cents"=>0, "update_return_url"=>nil, "updated_at"=>2013-11-12 03:51:18 UTC, "product_family"=>#<Chargify::ProductFamily:0x007fe6548f6820 @attributes={"accounting_code"=>nil, "description"=>nil, "handle"=>"acme-online", "id"=>3, "name"=>"Acme Online"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=false>, "credit_card"=>#<Chargify::Migration::CreditCard:0x007fe6548f5d58 @attributes={"type"=>"PaymentProfile", "billing_address"=>nil, "billing_address_2"=>nil, "billing_city"=>nil, "billing_country"=>nil, "billing_state"=>nil, "billing_zip"=>nil, "card_type"=>"bogus", "current_vault"=>"bogus", "customer_id"=>518, "customer_vault_token"=>nil, "expiration_month"=>1, "expiration_year"=>2023, "first_name"=>"Marky", "id"=>518, "last_name"=>"Mark", "masked_card_number"=>"XXXX-XXXX-XXXX-1", "vault_token"=>"1"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007fe656cc8320 @base=#<Chargify::Migration:0x007fe656cc8b90 ...>, @messages={}>>
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            # Preview a migration
         
     | 
| 
      
 25 
     | 
    
         
            +
            preview = Migration::Preview.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 26 
     | 
    
         
            +
            # => #<Chargify::Migration::Preview:0x007fe65686fb98 @attributes={"product_id"=>20, "prorated_adjustment_in_cents"=>"-9899", "charge_in_cents"=>"2400", "payment_due_in_cents"=>"0", "credit_applied_in_cents"=>"-7499"}, @prefix_options={}, @persisted=false, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007fe65686f260 @base=#<Chargify::Migration::Preview:0x007fe65686fb98 ...>, @messages={}>>
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            # Another way to preview a migration
         
     | 
| 
      
 29 
     | 
    
         
            +
            preview = Migration.preview(:subscription_id => subscription.id, :product_handle => "basic-plan")
         
     | 
| 
      
 30 
     | 
    
         
            +
            # => #<Chargify::Migration::Preview:0x007fe65686fb98 @attributes={"product_id"=>20, "prorated_adjustment_in_cents"=>"-9899", "charge_in_cents"=>"2400", "payment_due_in_cents"=>"0", "credit_applied_in_cents"=>"-7499"}, @prefix_options={}, @persisted=false, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007fe65686f260 @base=#<Chargify::Migration::Preview:0x007fe65686fb98 ...>, @messages={}>>
         
     | 
    
        data/examples/subscriptions.rb
    CHANGED
    
    | 
         @@ -12,9 +12,11 @@ end 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            # Retrieve a list of all your customers
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            subscriptions = Chargify::Subscription.find(:all)
         
     | 
| 
       16 
16 
     | 
    
         
             
            # => [#<Chargify::Subscription:0x1020fff70 @prefix_options={}, @attributes={"cancellation_message"=>nil, "activated_at"=>Tue Nov 17 15:51:42 UTC 2009, "expires_at"=>nil, "updated_at"=>Tue Nov 17 15:51:41 UTC 2009, "credit_card"=>#<Chargify::Subscription::CreditCard:0x1020f24d8 @prefix_options={}, @attributes={"card_type"=>"bogus", "expiration_year"=>2015, "masked_card_number"=>"XXXX-XXXX-XXXX-2", "first_name"=>"Michael", "expiration_month"=>1, "last_name"=>"Klett"}>, "product"=>#<Chargify::Product:0x1020f5a70 @prefix_options={}, @attributes={"price_in_cents"=>0, "name"=>"Chargify API Ares Test", "handle"=>"chargify-api-ares-test", "product_family"=>#<Chargify::Product::ProductFamily:0x1020f48f0 @prefix_options={}, @attributes={"name"=>"Chargify API ARes Test", "handle"=>"chargify-api-ares-test", "id"=>79, "accounting_code"=>nil}>, "id"=>153, "accounting_code"=>nil, "interval_unit"=>"month", "interval"=>1}>, "trial_ended_at"=>nil, "id"=>328, "current_period_ends_at"=>Thu Dec 17 15:51:41 UTC 2009, "trial_started_at"=>nil, "customer"=>#<Chargify::Customer:0x1020f6d80 @prefix_options={}, @attributes={"reference"=>"moklett", "updated_at"=>Tue Nov 17 15:51:02 UTC 2009, "id"=>331, "first_name"=>"Michael", "organization"=>"Chargify", "last_name"=>"Klett", "email"=>"moklett@example.com", "created_at"=>Tue Nov 17 15:51:02 UTC 2009}>, "balance_in_cents"=>0, "current_period_started_at"=>Tue Nov 17 15:51:41 UTC 2009, "state"=>"canceled", "created_at"=>Tue Nov 17 15:51:41 UTC 2009}>]]
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
            # Paginate through your subscriptions
         
     | 
| 
      
 19 
     | 
    
         
            +
            subscriptions = Chargify::Subscription.find(:all, params: { per_page: 50, page: 3})
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
            # Create a subscription from a customer reference
         
     | 
| 
       20 
22 
     | 
    
         
             
            subscription = Chargify::Subscription.create(
         
     | 
| 
         @@ -44,8 +46,7 @@ subscription.save 
     | 
|
| 
       44 
46 
     | 
    
         | 
| 
       45 
47 
     | 
    
         
             
            # Perform a one-time charge against an existing subscription
         
     | 
| 
       46 
48 
     | 
    
         
             
            subscription.charge(:amount => 10.00, :memo => 'Extra service')
         
     | 
| 
       47 
     | 
    
         
            -
            # => #< 
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
            # => #<Chargify::Charge:0x007f80da97b6b8 @attributes={"amount"=>10.00, "memo"=>"Extra service", "id"=>43010382, "amount_in_cents"=>1000, "component_id"=>nil, "created_at"=>2013-11-08 21:16:03 UTC, "ending_balance_in_cents"=>1000, "kind"=>"one_time", "payment_id"=>410383, "product_id"=>153, "starting_balance_in_cents"=>0, "success"=>true, "tax_id"=>nil, "type"=>"Charge", "transaction_type"=>"charge", "gateway_transaction_id"=>nil, "statement_id"=>25179695, "customer_id"=>40110}, @prefix_options={:subscription_id=>41630}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f80da97b0f0 @base=#<Chargify::Charge:0x007f80da97b6b8 ...>, @messages={}>>
         
     | 
| 
       49 
50 
     | 
    
         | 
| 
       50 
51 
     | 
    
         
             
            # Cancel a subscription
         
     | 
| 
       51 
52 
     | 
    
         
             
            subscription.cancel
         
     | 
    
        data/lib/chargify_api_ares.rb
    CHANGED
    
    | 
         @@ -1,10 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'active_resource'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'chargify_api_ares/config'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'chargify_api_ares/resources/base'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'chargify_api_ares/resources/charge'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'chargify_api_ares/resources/component'
         
     | 
| 
       5 
6 
     | 
    
         
             
            require 'chargify_api_ares/resources/coupon'
         
     | 
| 
       6 
7 
     | 
    
         
             
            require 'chargify_api_ares/resources/customer'
         
     | 
| 
       7 
8 
     | 
    
         
             
            require 'chargify_api_ares/resources/event'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'chargify_api_ares/resources/migration'
         
     | 
| 
       8 
10 
     | 
    
         
             
            require 'chargify_api_ares/resources/payment_profile'
         
     | 
| 
       9 
11 
     | 
    
         
             
            require 'chargify_api_ares/resources/product'
         
     | 
| 
       10 
12 
     | 
    
         
             
            require 'chargify_api_ares/resources/product_family'
         
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Chargify
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Migration < Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                self.prefix = "/subscriptions/:subscription_id/"
         
     | 
| 
      
 4 
     | 
    
         
            +
                
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.preview(attrs = {})
         
     | 
| 
      
 6 
     | 
    
         
            +
                  Chargify::Migration::Preview.create(attrs) 
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def subscription
         
     | 
| 
      
 10 
     | 
    
         
            +
                  self.attributes["id"].present? ? Chargify::Subscription.new(self.attributes) : nil
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                private
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                # Chargify returns a non-standard XML error response for Migration.  Since the API wants to maintain
         
     | 
| 
      
 16 
     | 
    
         
            +
                # backwards compatibility, we will work around that when we parse errors here by overriding the
         
     | 
| 
      
 17 
     | 
    
         
            +
                # framework's `load_remote_errors` with our own for just XML
         
     | 
| 
      
 18 
     | 
    
         
            +
                def load_remote_errors(remote_errors, save_cache = false)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  case self.class.format
         
     | 
| 
      
 20 
     | 
    
         
            +
                  when ActiveResource::Formats[:xml]
         
     | 
| 
      
 21 
     | 
    
         
            +
                    array = [Hash.from_xml(remote_errors.response.body)["errors"]] rescue []
         
     | 
| 
      
 22 
     | 
    
         
            +
                    errors.from_array array, save_cache
         
     | 
| 
      
 23 
     | 
    
         
            +
                  else
         
     | 
| 
      
 24 
     | 
    
         
            +
                    super
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                class Preview < Base
         
     | 
| 
      
 29 
     | 
    
         
            +
                  self.prefix = "/subscriptions/:subscription_id/migrations/"
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  def create
         
     | 
| 
      
 32 
     | 
    
         
            +
                    response = post(:preview, {}, attributes.send("to_#{self.class.format.extension}", :root => :migration, :dasherize => false))
         
     | 
| 
      
 33 
     | 
    
         
            +
                    load_attributes_from_response(response)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  private
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def custom_method_new_element_url(method_name, options = {})
         
     | 
| 
      
 39 
     | 
    
         
            +
                    "#{self.class.prefix(prefix_options)}#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -39,7 +39,7 @@ module Chargify 
     | 
|
| 
       39 
39 
     | 
    
         
             
                # For more information, please see the one-time charge API docs available
         
     | 
| 
       40 
40 
     | 
    
         
             
                # at: http://support.chargify.com/faqs/api/api-charges
         
     | 
| 
       41 
41 
     | 
    
         
             
                def charge(attrs = {})
         
     | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
      
 42 
     | 
    
         
            +
                  Chargify::Charge.create(attrs.merge(:subscription_id => self.id))
         
     | 
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                def credit(attrs = {})
         
     | 
| 
         @@ -59,7 +59,7 @@ module Chargify 
     | 
|
| 
       59 
59 
     | 
    
         
             
                end
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
                def migrate(attrs = {})
         
     | 
| 
       62 
     | 
    
         
            -
                   
     | 
| 
      
 62 
     | 
    
         
            +
                  Chargify::Migration.create(attrs.merge(:subscription_id => self.id))
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                def statement(id)
         
     | 
    
        data/spec/remote/remote_spec.rb
    CHANGED
    
    | 
         @@ -251,6 +251,145 @@ describe "Remote" do 
     | 
|
| 
       251 
251 
     | 
    
         
             
                end
         
     | 
| 
       252 
252 
     | 
    
         
             
              end
         
     | 
| 
       253 
253 
     | 
    
         | 
| 
      
 254 
     | 
    
         
            +
              describe "failing to add a one time charge" do
         
     | 
| 
      
 255 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 256 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 257 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 258 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 259 
     | 
    
         
            +
                    :payment_profile_attributes => declined_payment_profile_attributes)
         
     | 
| 
      
 260 
     | 
    
         
            +
                  
         
     | 
| 
      
 261 
     | 
    
         
            +
                  @charge = @subscription.charge(:amount => 7, :memo => 'One Time Charge')
         
     | 
| 
      
 262 
     | 
    
         
            +
                end
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
                it "is not valid when creating a charge fails" do
         
     | 
| 
      
 265 
     | 
    
         
            +
                  expect(@charge).to_not be_valid
         
     | 
| 
      
 266 
     | 
    
         
            +
                end
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
                it "has errors when creating a charge fails" do
         
     | 
| 
      
 269 
     | 
    
         
            +
                  expect(@charge.errors.full_messages.first).to eql "Bogus Gateway: Forced failure"
         
     | 
| 
      
 270 
     | 
    
         
            +
                end
         
     | 
| 
      
 271 
     | 
    
         
            +
              end
         
     | 
| 
      
 272 
     | 
    
         
            +
              
         
     | 
| 
      
 273 
     | 
    
         
            +
              describe "migrating a subscription to a valid product" do
         
     | 
| 
      
 274 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 275 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 276 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 277 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 278 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 279 
     | 
    
         
            +
                  
         
     | 
| 
      
 280 
     | 
    
         
            +
                  @migration = @subscription.migrate(:product_handle => pro_plan.handle)  
         
     | 
| 
      
 281 
     | 
    
         
            +
                end
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
      
 283 
     | 
    
         
            +
                it "is valid when the migration is successful" do
         
     | 
| 
      
 284 
     | 
    
         
            +
                  expect(@migration).to be_valid
         
     | 
| 
      
 285 
     | 
    
         
            +
                end
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
                it "migrates the product" do
         
     | 
| 
      
 288 
     | 
    
         
            +
                  expect(@migration.subscription.product.handle).to eql "pro"
         
     | 
| 
      
 289 
     | 
    
         
            +
                end
         
     | 
| 
      
 290 
     | 
    
         
            +
                
         
     | 
| 
      
 291 
     | 
    
         
            +
                it "has a subscription" do
         
     | 
| 
      
 292 
     | 
    
         
            +
                  expect(@migration.subscription).to_not be_nil
         
     | 
| 
      
 293 
     | 
    
         
            +
                end
         
     | 
| 
      
 294 
     | 
    
         
            +
              end
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
              describe "migrating a subscription to an invalid product" do
         
     | 
| 
      
 297 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 298 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 299 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 300 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 301 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 302 
     | 
    
         
            +
                  
         
     | 
| 
      
 303 
     | 
    
         
            +
                  @migration = @subscription.migrate(:product_handle => "a-bad-handle")  
         
     | 
| 
      
 304 
     | 
    
         
            +
                end
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
                it "is invalid when the migration is not successful" do
         
     | 
| 
      
 307 
     | 
    
         
            +
                  expect(@migration).to_not be_valid
         
     | 
| 
      
 308 
     | 
    
         
            +
                end
         
     | 
| 
      
 309 
     | 
    
         
            +
                
         
     | 
| 
      
 310 
     | 
    
         
            +
                it "is has errors when the migration is not successful" do
         
     | 
| 
      
 311 
     | 
    
         
            +
                  expect(@migration.errors.full_messages.first).to eql "Invalid Product"
         
     | 
| 
      
 312 
     | 
    
         
            +
                end
         
     | 
| 
      
 313 
     | 
    
         
            +
                
         
     | 
| 
      
 314 
     | 
    
         
            +
                it "will not have a subscription" do
         
     | 
| 
      
 315 
     | 
    
         
            +
                  expect(@migration.subscription).to be_nil
         
     | 
| 
      
 316 
     | 
    
         
            +
                end
         
     | 
| 
      
 317 
     | 
    
         
            +
              end
         
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
              describe "previewing a valid migration via Chargify::Migration" do
         
     | 
| 
      
 320 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 321 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 322 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 323 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 324 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 325 
     | 
    
         
            +
                  @preview = Chargify::Migration.preview(:subscription_id => @subscription.id, :product_handle => pro_plan.handle)  
         
     | 
| 
      
 326 
     | 
    
         
            +
                end
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
                it "is valid when the migration preview is successful" do
         
     | 
| 
      
 329 
     | 
    
         
            +
                  expect(@preview).to be_valid
         
     | 
| 
      
 330 
     | 
    
         
            +
                end
         
     | 
| 
      
 331 
     | 
    
         
            +
             
     | 
| 
      
 332 
     | 
    
         
            +
                it "is a proper preview" do
         
     | 
| 
      
 333 
     | 
    
         
            +
                  expect(@preview.charge_in_cents).to eql "5000"
         
     | 
| 
      
 334 
     | 
    
         
            +
                end
         
     | 
| 
      
 335 
     | 
    
         
            +
              end
         
     | 
| 
      
 336 
     | 
    
         
            +
              
         
     | 
| 
      
 337 
     | 
    
         
            +
              describe "previewing a valid migration via Chargify::Migration::Preview" do
         
     | 
| 
      
 338 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 339 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 340 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 341 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 342 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 343 
     | 
    
         
            +
                  @preview = Chargify::Migration::Preview.create(:subscription_id => @subscription.id, :product_handle => pro_plan.handle)  
         
     | 
| 
      
 344 
     | 
    
         
            +
                end
         
     | 
| 
      
 345 
     | 
    
         
            +
             
     | 
| 
      
 346 
     | 
    
         
            +
                it "is valid when the migration preview is successful" do
         
     | 
| 
      
 347 
     | 
    
         
            +
                  expect(@preview).to be_valid
         
     | 
| 
      
 348 
     | 
    
         
            +
                end
         
     | 
| 
      
 349 
     | 
    
         
            +
             
     | 
| 
      
 350 
     | 
    
         
            +
                it "is a proper preview" do
         
     | 
| 
      
 351 
     | 
    
         
            +
                  expect(@preview.charge_in_cents).to eql "5000"
         
     | 
| 
      
 352 
     | 
    
         
            +
                end
         
     | 
| 
      
 353 
     | 
    
         
            +
              end
         
     | 
| 
      
 354 
     | 
    
         
            +
              
         
     | 
| 
      
 355 
     | 
    
         
            +
              describe "previewing an invalid migration via Chargify::Migration" do
         
     | 
| 
      
 356 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 357 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 358 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 359 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 360 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 361 
     | 
    
         
            +
             
     | 
| 
      
 362 
     | 
    
         
            +
                  @preview = Chargify::Migration.preview(:subscription_id => @subscription.id, :product_id => 9999999) 
         
     | 
| 
      
 363 
     | 
    
         
            +
                end
         
     | 
| 
      
 364 
     | 
    
         
            +
             
     | 
| 
      
 365 
     | 
    
         
            +
                it "is invalid when the migration preview is invalid" do
         
     | 
| 
      
 366 
     | 
    
         
            +
                  expect(@preview).to_not be_valid
         
     | 
| 
      
 367 
     | 
    
         
            +
                end
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                it "has errors when the migration preview is invalid" do
         
     | 
| 
      
 370 
     | 
    
         
            +
                  expect(@preview.errors.full_messages.first).to eql "Product must be specified"
         
     | 
| 
      
 371 
     | 
    
         
            +
                end
         
     | 
| 
      
 372 
     | 
    
         
            +
              end
         
     | 
| 
      
 373 
     | 
    
         
            +
              
         
     | 
| 
      
 374 
     | 
    
         
            +
              describe "previewing an invalid migration via Chargify::Migration::Preview" do
         
     | 
| 
      
 375 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 376 
     | 
    
         
            +
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
      
 377 
     | 
    
         
            +
                    :product_handle => basic_plan.handle,
         
     | 
| 
      
 378 
     | 
    
         
            +
                    :customer_reference => johnadoe.reference,
         
     | 
| 
      
 379 
     | 
    
         
            +
                    :payment_profile_attributes => good_payment_profile_attributes)
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
      
 381 
     | 
    
         
            +
                  @preview = Chargify::Migration::Preview.create(:subscription_id => @subscription.id, :product_id => 9999999) 
         
     | 
| 
      
 382 
     | 
    
         
            +
                end
         
     | 
| 
      
 383 
     | 
    
         
            +
             
     | 
| 
      
 384 
     | 
    
         
            +
                it "is invalid when the migration preview is invalid" do
         
     | 
| 
      
 385 
     | 
    
         
            +
                  expect(@preview).to_not be_valid
         
     | 
| 
      
 386 
     | 
    
         
            +
                end
         
     | 
| 
      
 387 
     | 
    
         
            +
             
     | 
| 
      
 388 
     | 
    
         
            +
                it "has errors when the migration preview is invalid" do
         
     | 
| 
      
 389 
     | 
    
         
            +
                  expect(@preview.errors.full_messages.first).to eql "Product must be specified"
         
     | 
| 
      
 390 
     | 
    
         
            +
                end
         
     | 
| 
      
 391 
     | 
    
         
            +
              end
         
     | 
| 
      
 392 
     | 
    
         
            +
              
         
     | 
| 
       254 
393 
     | 
    
         
             
              describe "adding a credit" do
         
     | 
| 
       255 
394 
     | 
    
         
             
                before(:all) do
         
     | 
| 
       256 
395 
     | 
    
         
             
                  @subscription = Chargify::Subscription.create(
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Chargify::Charge, :fake_resource do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context '#create' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it 'creates a one-time charge' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  id = generate(:subscription_id)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  subscription = build(:subscription, :id => id)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expected_response = {:charge => {:amount_in_cents => 1000, :memo => "one-time charge", :success => true}}.to_xml
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  FakeWeb.register_uri(:post, "#{test_domain}/subscriptions/#{id}/charges.xml", :status => 201, :body => expected_response)
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                  response = Chargify::Charge.create(:subscription_id => subscription.id, :amount => "10.00", :memo => "one-time charge")
         
     | 
| 
      
 13 
     | 
    
         
            +
                
         
     | 
| 
      
 14 
     | 
    
         
            +
                  expect(response.valid?).to be_true
         
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(response).to be_a(Chargify::Charge)
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Chargify::Migration::Preview, :fake_resource do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context "#create" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it 'migrates the subscription' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  id = generate(:subscription_id)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  subscription = build(:subscription, :id => id)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  subscription.stub!(:persisted?).and_return(true)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expected_response = {:migration => {:prorated_adjustment_in_cents => -12500, :charge_in_cents => 90000, :payment_due_in_cents => 77500, :credit_applied_in_cents => 0 }}.to_xml
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  FakeWeb.register_uri(:post, "#{test_domain}/subscriptions/#{id}/migrations/preview.xml?product_handle=upgraded-plan", :status => 201, :body => expected_response)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  
         
     | 
| 
      
 13 
     | 
    
         
            +
                  response = Chargify::Migration::Preview.create(:subscription_id => subscription.id, :product_handle => 'upgraded-plan')
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(response.valid?).to be_true
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(response.errors.any?).to be_false
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(response).to be_a(Chargify::Migration::Preview)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end 
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Chargify::Migration, :fake_resource do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context "#create" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it 'migrates the subscription' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  id = generate(:subscription_id)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  subscription = build(:subscription, :id => id)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  subscription.stub!(:persisted?).and_return(true)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expected_response = [subscription.attributes].to_xml(:root => 'subscription')
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  FakeWeb.register_uri(:post, "#{test_domain}/subscriptions/#{id}/migrations.xml?migration%5Bproduct_handle%5D=upgraded-plan", :status => 201, :body => expected_response)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  
         
     | 
| 
      
 13 
     | 
    
         
            +
                  response = Chargify::Migration.create(:subscription_id => subscription.id, :product_handle => 'upgraded-plan')
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(response.valid?).to be_true
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(response.errors.any?).to be_false
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(response).to be_a(Chargify::Migration)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end 
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -41,8 +41,8 @@ describe Chargify::Subscription, :fake_resource do 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                response = subscription.charge(:amount => "10.00", "memo" => "one-time charge")
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                response. 
     | 
| 
       45 
     | 
    
         
            -
                response. 
     | 
| 
      
 44 
     | 
    
         
            +
                expect(response.valid?).to be_true
         
     | 
| 
      
 45 
     | 
    
         
            +
                expect(response).to be_a(Chargify::Charge)
         
     | 
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
              it 'finds by customer reference' do
         
     | 
| 
         @@ -76,7 +76,8 @@ describe Chargify::Subscription, :fake_resource do 
     | 
|
| 
       76 
76 
     | 
    
         | 
| 
       77 
77 
     | 
    
         
             
                response = subscription.migrate(:product_handle => 'upgraded-plan')
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                response. 
     | 
| 
       80 
     | 
    
         
            -
                response. 
     | 
| 
      
 79 
     | 
    
         
            +
                expect(response.valid?).to be_true
         
     | 
| 
      
 80 
     | 
    
         
            +
                expect(response.errors.any?).to be_false
         
     | 
| 
      
 81 
     | 
    
         
            +
                expect(response).to be_a(Chargify::Migration)
         
     | 
| 
       81 
82 
     | 
    
         
             
              end
         
     | 
| 
       82 
83 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: chargify_api_ares
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Michael Klett
         
     | 
| 
         @@ -11,31 +10,29 @@ authors: 
     | 
|
| 
       11 
10 
     | 
    
         
             
            - Jeremy W. Rowe
         
     | 
| 
       12 
11 
     | 
    
         
             
            - Rodrigo Franco
         
     | 
| 
       13 
12 
     | 
    
         
             
            - Shay Frendt
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Eric Farkas
         
     | 
| 
       14 
14 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2013-11-19 00:00:00.000000000 Z
         
     | 
| 
       18 
18 
     | 
    
         
             
            dependencies:
         
     | 
| 
       19 
19 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       20 
20 
     | 
    
         
             
              name: activeresource
         
     | 
| 
       21 
21 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       22 
     | 
    
         
            -
                none: false
         
     | 
| 
       23 
22 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - -  
     | 
| 
      
 23 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       25 
24 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
25 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
       27 
26 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       28 
27 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       29 
28 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
     | 
    
         
            -
                none: false
         
     | 
| 
       31 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       32 
     | 
    
         
            -
                - -  
     | 
| 
      
 30 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       33 
31 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       34 
32 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
       35 
33 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       36 
34 
     | 
    
         
             
              name: rake
         
     | 
| 
       37 
35 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       38 
     | 
    
         
            -
                none: false
         
     | 
| 
       39 
36 
     | 
    
         
             
                requirements:
         
     | 
| 
       40 
37 
     | 
    
         
             
                - - ~>
         
     | 
| 
       41 
38 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -43,7 +40,6 @@ dependencies: 
     | 
|
| 
       43 
40 
     | 
    
         
             
              type: :development
         
     | 
| 
       44 
41 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       45 
42 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       46 
     | 
    
         
            -
                none: false
         
     | 
| 
       47 
43 
     | 
    
         
             
                requirements:
         
     | 
| 
       48 
44 
     | 
    
         
             
                - - ~>
         
     | 
| 
       49 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -51,7 +47,6 @@ dependencies: 
     | 
|
| 
       51 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       52 
48 
     | 
    
         
             
              name: rspec
         
     | 
| 
       53 
49 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       54 
     | 
    
         
            -
                none: false
         
     | 
| 
       55 
50 
     | 
    
         
             
                requirements:
         
     | 
| 
       56 
51 
     | 
    
         
             
                - - ~>
         
     | 
| 
       57 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -59,7 +54,6 @@ dependencies: 
     | 
|
| 
       59 
54 
     | 
    
         
             
              type: :development
         
     | 
| 
       60 
55 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       61 
56 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       62 
     | 
    
         
            -
                none: false
         
     | 
| 
       63 
57 
     | 
    
         
             
                requirements:
         
     | 
| 
       64 
58 
     | 
    
         
             
                - - ~>
         
     | 
| 
       65 
59 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -67,7 +61,6 @@ dependencies: 
     | 
|
| 
       67 
61 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       68 
62 
     | 
    
         
             
              name: factory_girl
         
     | 
| 
       69 
63 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       70 
     | 
    
         
            -
                none: false
         
     | 
| 
       71 
64 
     | 
    
         
             
                requirements:
         
     | 
| 
       72 
65 
     | 
    
         
             
                - - ~>
         
     | 
| 
       73 
66 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -75,7 +68,6 @@ dependencies: 
     | 
|
| 
       75 
68 
     | 
    
         
             
              type: :development
         
     | 
| 
       76 
69 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       77 
70 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       78 
     | 
    
         
            -
                none: false
         
     | 
| 
       79 
71 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
72 
     | 
    
         
             
                - - ~>
         
     | 
| 
       81 
73 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -83,7 +75,6 @@ dependencies: 
     | 
|
| 
       83 
75 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
76 
     | 
    
         
             
              name: fakeweb
         
     | 
| 
       85 
77 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
     | 
    
         
            -
                none: false
         
     | 
| 
       87 
78 
     | 
    
         
             
                requirements:
         
     | 
| 
       88 
79 
     | 
    
         
             
                - - ~>
         
     | 
| 
       89 
80 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -91,7 +82,6 @@ dependencies: 
     | 
|
| 
       91 
82 
     | 
    
         
             
              type: :development
         
     | 
| 
       92 
83 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       93 
84 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       94 
     | 
    
         
            -
                none: false
         
     | 
| 
       95 
85 
     | 
    
         
             
                requirements:
         
     | 
| 
       96 
86 
     | 
    
         
             
                - - ~>
         
     | 
| 
       97 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -99,7 +89,6 @@ dependencies: 
     | 
|
| 
       99 
89 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       100 
90 
     | 
    
         
             
              name: faker
         
     | 
| 
       101 
91 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       102 
     | 
    
         
            -
                none: false
         
     | 
| 
       103 
92 
     | 
    
         
             
                requirements:
         
     | 
| 
       104 
93 
     | 
    
         
             
                - - ~>
         
     | 
| 
       105 
94 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -107,7 +96,6 @@ dependencies: 
     | 
|
| 
       107 
96 
     | 
    
         
             
              type: :development
         
     | 
| 
       108 
97 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       109 
98 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       110 
     | 
    
         
            -
                none: false
         
     | 
| 
       111 
99 
     | 
    
         
             
                requirements:
         
     | 
| 
       112 
100 
     | 
    
         
             
                - - ~>
         
     | 
| 
       113 
101 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -115,7 +103,6 @@ dependencies: 
     | 
|
| 
       115 
103 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       116 
104 
     | 
    
         
             
              name: guard-rspec
         
     | 
| 
       117 
105 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       118 
     | 
    
         
            -
                none: false
         
     | 
| 
       119 
106 
     | 
    
         
             
                requirements:
         
     | 
| 
       120 
107 
     | 
    
         
             
                - - ~>
         
     | 
| 
       121 
108 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -123,7 +110,6 @@ dependencies: 
     | 
|
| 
       123 
110 
     | 
    
         
             
              type: :development
         
     | 
| 
       124 
111 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       125 
112 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       126 
     | 
    
         
            -
                none: false
         
     | 
| 
       127 
113 
     | 
    
         
             
                requirements:
         
     | 
| 
       128 
114 
     | 
    
         
             
                - - ~>
         
     | 
| 
       129 
115 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -131,7 +117,6 @@ dependencies: 
     | 
|
| 
       131 
117 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       132 
118 
     | 
    
         
             
              name: growl
         
     | 
| 
       133 
119 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       134 
     | 
    
         
            -
                none: false
         
     | 
| 
       135 
120 
     | 
    
         
             
                requirements:
         
     | 
| 
       136 
121 
     | 
    
         
             
                - - ~>
         
     | 
| 
       137 
122 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -139,7 +124,6 @@ dependencies: 
     | 
|
| 
       139 
124 
     | 
    
         
             
              type: :development
         
     | 
| 
       140 
125 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       141 
126 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       142 
     | 
    
         
            -
                none: false
         
     | 
| 
       143 
127 
     | 
    
         
             
                requirements:
         
     | 
| 
       144 
128 
     | 
    
         
             
                - - ~>
         
     | 
| 
       145 
129 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -147,7 +131,6 @@ dependencies: 
     | 
|
| 
       147 
131 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       148 
132 
     | 
    
         
             
              name: rb-fsevent
         
     | 
| 
       149 
133 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       150 
     | 
    
         
            -
                none: false
         
     | 
| 
       151 
134 
     | 
    
         
             
                requirements:
         
     | 
| 
       152 
135 
     | 
    
         
             
                - - ~>
         
     | 
| 
       153 
136 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -155,7 +138,6 @@ dependencies: 
     | 
|
| 
       155 
138 
     | 
    
         
             
              type: :development
         
     | 
| 
       156 
139 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       157 
140 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       158 
     | 
    
         
            -
                none: false
         
     | 
| 
       159 
141 
     | 
    
         
             
                requirements:
         
     | 
| 
       160 
142 
     | 
    
         
             
                - - ~>
         
     | 
| 
       161 
143 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -163,7 +145,6 @@ dependencies: 
     | 
|
| 
       163 
145 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       164 
146 
     | 
    
         
             
              name: pry
         
     | 
| 
       165 
147 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       166 
     | 
    
         
            -
                none: false
         
     | 
| 
       167 
148 
     | 
    
         
             
                requirements:
         
     | 
| 
       168 
149 
     | 
    
         
             
                - - ~>
         
     | 
| 
       169 
150 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -171,7 +152,6 @@ dependencies: 
     | 
|
| 
       171 
152 
     | 
    
         
             
              type: :development
         
     | 
| 
       172 
153 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       173 
154 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       174 
     | 
    
         
            -
                none: false
         
     | 
| 
       175 
155 
     | 
    
         
             
                requirements:
         
     | 
| 
       176 
156 
     | 
    
         
             
                - - ~>
         
     | 
| 
       177 
157 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
         @@ -187,23 +167,28 @@ files: 
     | 
|
| 
       187 
167 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       188 
168 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       189 
169 
     | 
    
         
             
            - Guardfile
         
     | 
| 
      
 170 
     | 
    
         
            +
            - HISTORY.md
         
     | 
| 
       190 
171 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       191 
172 
     | 
    
         
             
            - README.md
         
     | 
| 
       192 
173 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       193 
174 
     | 
    
         
             
            - chargify_api_ares.gemspec
         
     | 
| 
      
 175 
     | 
    
         
            +
            - examples/charges.rb
         
     | 
| 
       194 
176 
     | 
    
         
             
            - examples/coupons.rb
         
     | 
| 
       195 
177 
     | 
    
         
             
            - examples/customers.rb
         
     | 
| 
       196 
178 
     | 
    
         
             
            - examples/metered_components.rb
         
     | 
| 
      
 179 
     | 
    
         
            +
            - examples/migrations.rb
         
     | 
| 
       197 
180 
     | 
    
         
             
            - examples/products.rb
         
     | 
| 
       198 
181 
     | 
    
         
             
            - examples/subscriptions.rb
         
     | 
| 
       199 
182 
     | 
    
         
             
            - examples/transactions.rb
         
     | 
| 
       200 
183 
     | 
    
         
             
            - lib/chargify_api_ares.rb
         
     | 
| 
       201 
184 
     | 
    
         
             
            - lib/chargify_api_ares/config.rb
         
     | 
| 
       202 
185 
     | 
    
         
             
            - lib/chargify_api_ares/resources/base.rb
         
     | 
| 
      
 186 
     | 
    
         
            +
            - lib/chargify_api_ares/resources/charge.rb
         
     | 
| 
       203 
187 
     | 
    
         
             
            - lib/chargify_api_ares/resources/component.rb
         
     | 
| 
       204 
188 
     | 
    
         
             
            - lib/chargify_api_ares/resources/coupon.rb
         
     | 
| 
       205 
189 
     | 
    
         
             
            - lib/chargify_api_ares/resources/customer.rb
         
     | 
| 
       206 
190 
     | 
    
         
             
            - lib/chargify_api_ares/resources/event.rb
         
     | 
| 
      
 191 
     | 
    
         
            +
            - lib/chargify_api_ares/resources/migration.rb
         
     | 
| 
       207 
192 
     | 
    
         
             
            - lib/chargify_api_ares/resources/payment_profile.rb
         
     | 
| 
       208 
193 
     | 
    
         
             
            - lib/chargify_api_ares/resources/product.rb
         
     | 
| 
       209 
194 
     | 
    
         
             
            - lib/chargify_api_ares/resources/product_family.rb
         
     | 
| 
         @@ -219,8 +204,11 @@ files: 
     | 
|
| 
       219 
204 
     | 
    
         
             
            - spec/remote/remote_helper.rb
         
     | 
| 
       220 
205 
     | 
    
         
             
            - spec/remote/remote_spec.rb
         
     | 
| 
       221 
206 
     | 
    
         
             
            - spec/resources/base_spec.rb
         
     | 
| 
      
 207 
     | 
    
         
            +
            - spec/resources/charge_spec.rb
         
     | 
| 
       222 
208 
     | 
    
         
             
            - spec/resources/coupon_spec.rb
         
     | 
| 
       223 
209 
     | 
    
         
             
            - spec/resources/customer_spec.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - spec/resources/migration_preview_spec.rb
         
     | 
| 
      
 211 
     | 
    
         
            +
            - spec/resources/migration_spec.rb
         
     | 
| 
       224 
212 
     | 
    
         
             
            - spec/resources/product_family_component_spec.rb
         
     | 
| 
       225 
213 
     | 
    
         
             
            - spec/resources/product_family_spec.rb
         
     | 
| 
       226 
214 
     | 
    
         
             
            - spec/resources/product_spec.rb
         
     | 
| 
         @@ -232,28 +220,24 @@ files: 
     | 
|
| 
       232 
220 
     | 
    
         
             
            - spec/support/fake_resource.rb
         
     | 
| 
       233 
221 
     | 
    
         
             
            homepage: http://github.com/chargify/chargify_api_ares
         
     | 
| 
       234 
222 
     | 
    
         
             
            licenses: []
         
     | 
| 
      
 223 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       235 
224 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       236 
225 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       237 
226 
     | 
    
         
             
            require_paths:
         
     | 
| 
       238 
227 
     | 
    
         
             
            - lib
         
     | 
| 
       239 
228 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       240 
     | 
    
         
            -
              none: false
         
     | 
| 
       241 
229 
     | 
    
         
             
              requirements:
         
     | 
| 
       242 
     | 
    
         
            -
              - -  
     | 
| 
      
 230 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       243 
231 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       244 
232 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       245 
     | 
    
         
            -
                  segments:
         
     | 
| 
       246 
     | 
    
         
            -
                  - 0
         
     | 
| 
       247 
     | 
    
         
            -
                  hash: 4368782760728078099
         
     | 
| 
       248 
233 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       249 
     | 
    
         
            -
              none: false
         
     | 
| 
       250 
234 
     | 
    
         
             
              requirements:
         
     | 
| 
       251 
     | 
    
         
            -
              - -  
     | 
| 
      
 235 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       252 
236 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       253 
237 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       254 
238 
     | 
    
         
             
            requirements: []
         
     | 
| 
       255 
239 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       256 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 240 
     | 
    
         
            +
            rubygems_version: 2.0.6
         
     | 
| 
       257 
241 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       258 
242 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       259 
243 
     | 
    
         
             
            summary: A Chargify API wrapper for Ruby using ActiveResource
         
     | 
| 
         @@ -263,8 +247,11 @@ test_files: 
     | 
|
| 
       263 
247 
     | 
    
         
             
            - spec/remote/remote_helper.rb
         
     | 
| 
       264 
248 
     | 
    
         
             
            - spec/remote/remote_spec.rb
         
     | 
| 
       265 
249 
     | 
    
         
             
            - spec/resources/base_spec.rb
         
     | 
| 
      
 250 
     | 
    
         
            +
            - spec/resources/charge_spec.rb
         
     | 
| 
       266 
251 
     | 
    
         
             
            - spec/resources/coupon_spec.rb
         
     | 
| 
       267 
252 
     | 
    
         
             
            - spec/resources/customer_spec.rb
         
     | 
| 
      
 253 
     | 
    
         
            +
            - spec/resources/migration_preview_spec.rb
         
     | 
| 
      
 254 
     | 
    
         
            +
            - spec/resources/migration_spec.rb
         
     | 
| 
       268 
255 
     | 
    
         
             
            - spec/resources/product_family_component_spec.rb
         
     | 
| 
       269 
256 
     | 
    
         
             
            - spec/resources/product_family_spec.rb
         
     | 
| 
       270 
257 
     | 
    
         
             
            - spec/resources/product_spec.rb
         
     |