invoiced 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e536c65fccac56b2d988c5fe3aaecbc5c4c68ef4
4
- data.tar.gz: d88a8e2e379d5b83b3d422dfefbd90125df90876
3
+ metadata.gz: fa11b34d70bec29ca5779f24577e670d2c353334
4
+ data.tar.gz: effd3ba53fa846fc0bfeab4d7857ef175556883a
5
5
  SHA512:
6
- metadata.gz: 1432a26201de6db700fc04eecdd012f10e75357bb19111c980f7044ffdb5ed5b0001c27d8b96f2ed9e922a7399e3316892468daf47b5ee6abae7621347ebe7c5
7
- data.tar.gz: f0c8fe2b96eb1bd0c470a42bbe12ec736c6afa219511d4d19a1f768ab0ba848392c0ab31729670ac4884a81e43861f7f1c231615bb018acfa4fcd680e9033873
6
+ metadata.gz: 9c4fa6e0cd27496ba092cb48d3f0d150d73ebd337d97afbf262af900693aead1489a3aa92f2055bddb110e33918ad33479dfd62c3d5dd68c3ec924125d42470b
7
+ data.tar.gz: ceab2b357f815ddd111bfb6b8efc31800f0d64c4a606e36390dae60ce9552a8e24653fde7968b72a51e0c4161bf0a705e36740353aeaf44ea676cf17a4bd0561
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ gem 'json', '~> 1.8.3'
5
5
  gem 'rest-client', '~> 1.8.0'
6
6
  gem 'activesupport', '~> 4.2.3'
7
7
  gem 'coveralls', :require => false, :group => :test
8
- gem 'simplecov', :require => false, :group => :test
8
+ gem 'simplecov', '~> 0.10.0', :require => false, :group => :test
9
9
  gem 'simplecov-console', :require => false, :group => :test
@@ -6,9 +6,12 @@ module Invoiced
6
6
 
7
7
  if response[:code] == 204
8
8
  refresh_from({:id => @id})
9
+ elsif response[:code] == 200
10
+ # update the local values with the response
11
+ refresh_from(response[:body].dup.merge({:id => self.id}))
9
12
  end
10
13
 
11
- return response[:code] == 204
14
+ return response[:code] == 204 || response[:code] == 200
12
15
  end
13
16
  end
14
17
  end
@@ -1,3 +1,3 @@
1
1
  module Invoiced
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -77,14 +77,15 @@ module Invoiced
77
77
 
78
78
  should "cancel a subscription" do
79
79
  mockResponse = mock('RestClient::Response')
80
- mockResponse.stubs(:code).returns(204)
81
- mockResponse.stubs(:body).returns('')
80
+ mockResponse.stubs(:code).returns(200)
81
+ mockResponse.stubs(:body).returns('{"id":123,"plan":"pro","status":"canceled"}')
82
82
  mockResponse.stubs(:headers).returns({})
83
83
 
84
84
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
85
85
 
86
86
  subscription = Subscription.new(@client, 123)
87
87
  assert_true(subscription.cancel)
88
+ assert_equal("canceled", subscription.status)
88
89
  end
89
90
  end
90
91
  end
data/test/test_helper.rb CHANGED
@@ -2,10 +2,10 @@ require 'simplecov'
2
2
  require 'simplecov-console'
3
3
  require 'coveralls'
4
4
 
5
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
5
+ SimpleCov.formatters = [
6
6
  SimpleCov::Formatter::Console,
7
7
  Coveralls::SimpleCov::Formatter
8
- ])
8
+ ]
9
9
  SimpleCov.start do
10
10
  add_filter 'test/'
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoiced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared King
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-30 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client