chartmogul_client 0.0.5 → 0.0.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94e8d445c932669fc764f3a64500dedd64c6dd89
|
4
|
+
data.tar.gz: 5fd964288d3394cb7549aaf2b46d8f99eb63debf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca376a1bb793972dba5df4fa10a709384dc6193d7f53feb8879642c177ce3cfde8c607bb8f4be1c6d4ff86b780c5db4708cdbb7db08980e7aaf47af84622ba1d
|
7
|
+
data.tar.gz: dadbecf5a5be70764ebfe05012a4a1fccd29e8c0d25472335dd789817d5101b4785b37342b1789b4c6aec6b2b0568998f4bb3bff2319127d1e497d8b8ab67ba0
|
data/lib/chartmogul/v1/import.rb
CHANGED
@@ -17,9 +17,17 @@ module Chartmogul
|
|
17
17
|
Chartmogul::V1::Import::Plans.new(client)
|
18
18
|
end
|
19
19
|
|
20
|
+
# Public: Get subscriptions API.
|
21
|
+
#
|
22
|
+
# Returns the instance of Chartmogul::V1::Import::Subscriptions.
|
23
|
+
def subscriptions
|
24
|
+
Chartmogul::V1::Import::Subscriptions.new(client)
|
25
|
+
end
|
26
|
+
|
20
27
|
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
24
31
|
require 'chartmogul/v1/import/customers'
|
25
32
|
require 'chartmogul/v1/import/plans'
|
33
|
+
require 'chartmogul/v1/import/subscriptions'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Chartmogul
|
2
|
+
module V1
|
3
|
+
class Import::Subscriptions < Chartmogul::V1::Base
|
4
|
+
BASE_URI = "#{BASE_URI}/import"
|
5
|
+
|
6
|
+
# Public: Cancel Imported Customer's Subscription.
|
7
|
+
#
|
8
|
+
# See: https://dev.chartmogul.com/docs/cancel-a-customers-subscription
|
9
|
+
#
|
10
|
+
# uuid - The String ChartMogul UUID of the subscription that needs to be cancelled.
|
11
|
+
# cancelled_at - The Time at which the subscription was cancelled.
|
12
|
+
#
|
13
|
+
# Returns the instance of Chartmogul::V1::Request.
|
14
|
+
def cancel(uuid, cancelled_at)
|
15
|
+
Chartmogul::V1::Request.new("#{BASE_URI}/subscriptions/#{uuid}",
|
16
|
+
body: { cancelled_at: cancelled_at.iso8601 },
|
17
|
+
method: :put,
|
18
|
+
userpwd: client.userpwd,
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Public: List Customer's Subscriptions.
|
23
|
+
#
|
24
|
+
# See: https://dev.chartmogul.com/docs/list-a-customers-subscriptions
|
25
|
+
#
|
26
|
+
# uuid - The String ChartMogul UUID of the Customer whose subscriptions are required. Specified as part of the URL.
|
27
|
+
#
|
28
|
+
# Returns the instance of Chartmogul::V1::Request.
|
29
|
+
def list(uuid)
|
30
|
+
Chartmogul::V1::Request.new "#{BASE_URI}/customers/#{uuid}/subscriptions", userpwd: client.userpwd
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/chartmogul/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chartmogul::V1::Import::Subscriptions do
|
4
|
+
|
5
|
+
let(:client) { Chartmogul::Client.new }
|
6
|
+
|
7
|
+
describe '#cancel' do
|
8
|
+
let(:url) { 'https://api.chartmogul.com/v1/import/subscriptions/uuid' }
|
9
|
+
let(:cancelled_at) { Time.now }
|
10
|
+
let(:body) { { cancelled_at: cancelled_at.iso8601 } }
|
11
|
+
let(:query) { {} }
|
12
|
+
|
13
|
+
before do
|
14
|
+
stub_request(:put, url).with(body: body.to_json).to_return(status: 200)
|
15
|
+
end
|
16
|
+
|
17
|
+
subject { client.import.subscriptions.cancel('uuid', cancelled_at) }
|
18
|
+
|
19
|
+
it_should_behave_like 'a base ChartMogul API V1 requests', method: :put
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#list' do
|
23
|
+
let(:url) { 'https://api.chartmogul.com/v1/import/customers/uuid/subscriptions' }
|
24
|
+
let(:query) { { } }
|
25
|
+
|
26
|
+
before do
|
27
|
+
stub_request(:get, url).with(query: query).to_return(status: 200)
|
28
|
+
end
|
29
|
+
|
30
|
+
subject { client.import.subscriptions.list('uuid') }
|
31
|
+
|
32
|
+
it_should_behave_like 'a base ChartMogul API V1 requests'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -11,4 +11,18 @@ RSpec.describe Chartmogul::V1::Import do
|
|
11
11
|
it { expect(subject.client).to eq client }
|
12
12
|
end
|
13
13
|
|
14
|
+
describe '#plans' do
|
15
|
+
subject { client.import.plans }
|
16
|
+
|
17
|
+
it { expect(subject).to be_a Chartmogul::V1::Import::Plans }
|
18
|
+
it { expect(subject.client).to eq client }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#subscriptions' do
|
22
|
+
subject { client.import.subscriptions }
|
23
|
+
|
24
|
+
it { expect(subject).to be_a Chartmogul::V1::Import::Subscriptions }
|
25
|
+
it { expect(subject.client).to eq client }
|
26
|
+
end
|
27
|
+
|
14
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chartmogul_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vokhmin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/chartmogul/v1/import/customers.rb
|
119
119
|
- lib/chartmogul/v1/import/invoices.rb
|
120
120
|
- lib/chartmogul/v1/import/plans.rb
|
121
|
+
- lib/chartmogul/v1/import/subscriptions.rb
|
121
122
|
- lib/chartmogul/v1/request.rb
|
122
123
|
- lib/chartmogul/version.rb
|
123
124
|
- lib/chartmogul_client.rb
|
@@ -126,6 +127,7 @@ files:
|
|
126
127
|
- spec/chartmogul/v1/import/customers_spec.rb
|
127
128
|
- spec/chartmogul/v1/import/invoices_spec.rb
|
128
129
|
- spec/chartmogul/v1/import/plans_spec.rb
|
130
|
+
- spec/chartmogul/v1/import/subscriptions_spec.rb
|
129
131
|
- spec/chartmogul/v1/import_spec.rb
|
130
132
|
- spec/spec_helper.rb
|
131
133
|
- spec/support/shared_examples/chartmogul_api_v1_examples.rb
|
@@ -159,6 +161,7 @@ test_files:
|
|
159
161
|
- spec/chartmogul/v1/import/customers_spec.rb
|
160
162
|
- spec/chartmogul/v1/import/invoices_spec.rb
|
161
163
|
- spec/chartmogul/v1/import/plans_spec.rb
|
164
|
+
- spec/chartmogul/v1/import/subscriptions_spec.rb
|
162
165
|
- spec/chartmogul/v1/import_spec.rb
|
163
166
|
- spec/spec_helper.rb
|
164
167
|
- spec/support/shared_examples/chartmogul_api_v1_examples.rb
|