chargify_api_ares 0.3.4 → 0.3.5
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.
- data/VERSION +1 -1
- data/chargify_api_ares.gemspec +4 -4
- data/lib/chargify_api_ares.rb +8 -0
- data/spec/remote/remote_spec.rb +25 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/subscription_spec.rb +13 -1
- metadata +4 -4
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.3. | 
| 1 | 
            +
            0.3.5
         | 
    
        data/chargify_api_ares.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{chargify_api_ares}
         | 
| 8 | 
            -
              s.version = "0.3. | 
| 8 | 
            +
              s.version = "0.3.5"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Michael Klett", "The Lab Rats @ Phase Two Labs", "Brian Rose", "Nathan Verni"]
         | 
| 12 | 
            -
              s.date = %q{2010-08- | 
| 12 | 
            +
              s.date = %q{2010-08-25}
         | 
| 13 13 | 
             
              s.description = %q{}
         | 
| 14 14 | 
             
              s.email = %q{mklett@grasshopper.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -46,7 +46,7 @@ Gem::Specification.new do |s| | |
| 46 46 | 
             
              s.homepage = %q{http://github.com/grasshopperlabs/chargify_api_ares}
         | 
| 47 47 | 
             
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 48 48 | 
             
              s.require_paths = ["lib"]
         | 
| 49 | 
            -
              s.rubygems_version = %q{1.3. | 
| 49 | 
            +
              s.rubygems_version = %q{1.3.7}
         | 
| 50 50 | 
             
              s.summary = %q{A Chargify API wrapper for Ruby using ActiveResource}
         | 
| 51 51 | 
             
              s.test_files = [
         | 
| 52 52 | 
             
                "spec/base_spec.rb",
         | 
| @@ -66,7 +66,7 @@ Gem::Specification.new do |s| | |
| 66 66 | 
             
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 67 67 | 
             
                s.specification_version = 3
         | 
| 68 68 |  | 
| 69 | 
            -
                if Gem::Version.new(Gem:: | 
| 69 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 70 70 | 
             
                else
         | 
| 71 71 | 
             
                end
         | 
| 72 72 | 
             
              else
         | 
    
        data/lib/chargify_api_ares.rb
    CHANGED
    
    | @@ -141,6 +141,10 @@ module Chargify | |
| 141 141 | 
             
                  post :credits, :credit => attrs
         | 
| 142 142 | 
             
                end
         | 
| 143 143 |  | 
| 144 | 
            +
                def refund(attrs = {})
         | 
| 145 | 
            +
                  post :refunds, :refund => attrs
         | 
| 146 | 
            +
                end
         | 
| 147 | 
            +
                
         | 
| 144 148 | 
             
                def reactivate(params = {})
         | 
| 145 149 | 
             
                  put :reactivate, params
         | 
| 146 150 | 
             
                end
         | 
| @@ -149,6 +153,10 @@ module Chargify | |
| 149 153 | 
             
                  put :reset_balance
         | 
| 150 154 | 
             
                end
         | 
| 151 155 |  | 
| 156 | 
            +
                def migrate(attrs = {})
         | 
| 157 | 
            +
                  post :migrations, :migration => attrs
         | 
| 158 | 
            +
                end
         | 
| 159 | 
            +
                
         | 
| 152 160 | 
             
                def transactions()
         | 
| 153 161 | 
             
                  Transaction.find(:all, :params =>{:subscription_id => self.id})
         | 
| 154 162 | 
             
                end
         | 
    
        data/spec/remote/remote_spec.rb
    CHANGED
    
    | @@ -255,6 +255,30 @@ if run_remote_tests? | |
| 255 255 | 
             
                  end
         | 
| 256 256 | 
             
                end
         | 
| 257 257 |  | 
| 258 | 
            +
                describe "adding a refund" do
         | 
| 259 | 
            +
                  before(:each) do
         | 
| 260 | 
            +
                    @subscription = create_once(:subscription) do
         | 
| 261 | 
            +
                      Chargify::Subscription.create(
         | 
| 262 | 
            +
                        :product_handle => @@pro_plan.handle,
         | 
| 263 | 
            +
                        :customer_reference => @@johnadoe.reference,
         | 
| 264 | 
            +
                        :payment_profile_attributes => good_payment_profile_attributes
         | 
| 265 | 
            +
                      )
         | 
| 266 | 
            +
                    end
         | 
| 267 | 
            +
             | 
| 268 | 
            +
                    @subscription.charge(:amount => 7, :memo => 'One Time Charge')
         | 
| 269 | 
            +
                    @subscription.reload
         | 
| 270 | 
            +
                  end
         | 
| 271 | 
            +
             | 
| 272 | 
            +
                  it "creates a refund" do
         | 
| 273 | 
            +
                    lambda{
         | 
| 274 | 
            +
                      @subscription.refund :payment_id => @subscription.transactions[0].id, :amount => 7, 
         | 
| 275 | 
            +
                        :memo => 'Refunding One Time Charge'
         | 
| 276 | 
            +
                    }.should change{@subscription.reload.transactions.size}.by(1)
         | 
| 277 | 
            +
                    @subscription.transactions.first.amount_in_cents.should == 700
         | 
| 278 | 
            +
                    @subscription.transactions.first.transaction_type.should == 'refund'
         | 
| 279 | 
            +
                  end
         | 
| 280 | 
            +
                end
         | 
| 281 | 
            +
                
         | 
| 258 282 | 
             
                def already_cleared_site_data?
         | 
| 259 283 | 
             
                  @@already_cleared_site_data ||= nil
         | 
| 260 284 | 
             
                  @@already_cleared_site_data == true
         | 
| @@ -285,7 +309,7 @@ if run_remote_tests? | |
| 285 309 | 
             
                    result = @@acme_projects.save
         | 
| 286 310 | 
             
                    result.should be_true
         | 
| 287 311 | 
             
                  end
         | 
| 288 | 
            -
             | 
| 312 | 
            +
                  
         | 
| 289 313 | 
             
                  begin
         | 
| 290 314 | 
             
                    @@basic_plan ||= Chargify::Product.find_by_handle('basic')
         | 
| 291 315 | 
             
                  rescue ActiveResource::ResourceNotFound
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        data/spec/subscription_spec.rb
    CHANGED
    
    | @@ -63,4 +63,16 @@ describe Chargify::Subscription do | |
| 63 63 | 
             
                @subscription.cancel
         | 
| 64 64 | 
             
                find_subscription.should raise_error
         | 
| 65 65 | 
             
              end
         | 
| 66 | 
            -
             | 
| 66 | 
            +
             | 
| 67 | 
            +
              it 'migrates the subscription' do
         | 
| 68 | 
            +
                id = Factory.next(:subscription_id)
         | 
| 69 | 
            +
                subscription = Factory(:subscription, :id => id)
         | 
| 70 | 
            +
                expected_response = [subscription.attributes].to_xml(:root => 'subscription')
         | 
| 71 | 
            +
                FakeWeb.register_uri(:post, "#{test_domain}/subscriptions/#{id}/migrations.xml?migration%5Bproduct_handle%5D=upgraded-plan", :status => 201, :body => expected_response)
         | 
| 72 | 
            +
                
         | 
| 73 | 
            +
                response = subscription.migrate(:product_handle => 'upgraded-plan')
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                response.body.should == expected_response
         | 
| 76 | 
            +
                response.should be_a(Net::HTTPCreated)
         | 
| 77 | 
            +
              end
         | 
| 78 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: chargify_api_ares
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 25
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 3
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.3. | 
| 9 | 
            +
              - 5
         | 
| 10 | 
            +
              version: 0.3.5
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Michael Klett
         | 
| @@ -18,7 +18,7 @@ autorequire: | |
| 18 18 | 
             
            bindir: bin
         | 
| 19 19 | 
             
            cert_chain: []
         | 
| 20 20 |  | 
| 21 | 
            -
            date: 2010-08- | 
| 21 | 
            +
            date: 2010-08-25 00:00:00 -04:00
         | 
| 22 22 | 
             
            default_executable: 
         | 
| 23 23 | 
             
            dependencies: []
         | 
| 24 24 |  |