chartmogul_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chartmogul/v1/import/customers.rb +51 -0
- data/lib/chartmogul/v1/import/invoices.rb +21 -0
- data/lib/chartmogul/v1/import.rb +3 -40
- data/lib/chartmogul/version.rb +1 -1
- data/spec/chartmogul/v1/import/customers_spec.rb +39 -0
- data/spec/chartmogul/v1/import/invoices_spec.rb +20 -0
- data/spec/chartmogul/v1/import_spec.rb +0 -27
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11dfe4c4cc311dbad2aae85865d08704cdcac56f
|
4
|
+
data.tar.gz: 056f8a8441dee5682fd75e8b76743fd66b23097d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdf7244fb9332a10169882b00bc2fb440505039e80be882a16b6f1ccad300223f10f3d7336aed605b86c555a67f7081fb26693fdb526473eaf3b6b408fafb118
|
7
|
+
data.tar.gz: 6bb25c6ff24b83ba69fc444e29c682819226461e1e0498f16ed806f6004a6bb1da021495293080a6de719975eacd5d4795b75f6f5134df5e2f3fe42837aa0878
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'chartmogul/v1/import/invoices'
|
2
|
+
|
3
|
+
module Chartmogul
|
4
|
+
module V1
|
5
|
+
class Import::Customers < Chartmogul::V1::Base
|
6
|
+
BASE_URI = "#{BASE_URI}/import/customers"
|
7
|
+
|
8
|
+
# Public: Get invoices API.
|
9
|
+
#
|
10
|
+
# Returns the instance of Chartmogul::V1::Import::Invoices.
|
11
|
+
def invoices
|
12
|
+
Chartmogul::V1::Import::Invoices.new(client)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Public: Import a Customer.
|
16
|
+
#
|
17
|
+
# See: https://dev.chartmogul.com/docs/import-customer
|
18
|
+
#
|
19
|
+
# options - The Hash options used to create a Customer (default: {}):
|
20
|
+
# :data_source_uuid - The String ChartMogul UUID of the data
|
21
|
+
# source that this customer comes from.
|
22
|
+
# :external_id - The String unique identifier specified by you for the customer.
|
23
|
+
# Typically an identifier from your internal system.
|
24
|
+
# Accepts alphanumeric characters.
|
25
|
+
# :name - The String name of the customer for display purposes.
|
26
|
+
# Accepts alphanumeric characters.
|
27
|
+
# :email - The String Email address of the customer (optional).
|
28
|
+
# :company - The String customer's company or organisation (optional).
|
29
|
+
# :country - The String Country code of customer's location
|
30
|
+
# as per ISO-3166 alpha-2 standard (optional).
|
31
|
+
# :state - The String State code of customer's location
|
32
|
+
# as per ISO-3166 alpha-2 standard (optional).
|
33
|
+
# :city - The String city of the customer's location (optional).
|
34
|
+
# :zip - The String zip code of the customer's location (optional).
|
35
|
+
#
|
36
|
+
# Returns the instance of Chartmogul::V1::Request.
|
37
|
+
def create(**options)
|
38
|
+
Chartmogul::V1::Request.new "#{BASE_URI}", options.merge(method: :post, userpwd: client.userpwd)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Public: Get list Customers.
|
42
|
+
#
|
43
|
+
# See: https://dev.chartmogul.com/docs/list-all-imported-customers
|
44
|
+
#
|
45
|
+
# Returns the instance of Chartmogul::V1::Request.
|
46
|
+
def list
|
47
|
+
Chartmogul::V1::Request.new "#{BASE_URI}", userpwd: client.userpwd
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Chartmogul
|
2
|
+
module V1
|
3
|
+
class Import::Invoices < Chartmogul::V1::Base
|
4
|
+
BASE_URI = "#{BASE_URI}/import/customers"
|
5
|
+
|
6
|
+
# Public: Import Invoices.
|
7
|
+
#
|
8
|
+
# See: https://dev.chartmogul.com/docs/invoices
|
9
|
+
#
|
10
|
+
# customer_id - The String/Integer ChartMogul ID of the customer.
|
11
|
+
# Specified as part of the URL.
|
12
|
+
# options - The Hash options used to create a Invoices (default: {}).
|
13
|
+
#
|
14
|
+
# Returns the instance of Chartmogul::V1::Request.
|
15
|
+
def create(customer_id, **options)
|
16
|
+
Chartmogul::V1::Request.new "#{BASE_URI}/#{customer_id}/invoices", options.merge(method: :post, userpwd: client.userpwd)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/chartmogul/v1/import.rb
CHANGED
@@ -7,48 +7,11 @@ module Chartmogul
|
|
7
7
|
#
|
8
8
|
# Returns the instance of Chartmogul::V1::Import::Customers.
|
9
9
|
def customers
|
10
|
-
Customers.new(client)
|
11
|
-
end
|
12
|
-
|
13
|
-
class Customers < Import
|
14
|
-
BASE_URI = "#{BASE_URI}/customers"
|
15
|
-
|
16
|
-
# Public: Import a Customer.
|
17
|
-
#
|
18
|
-
# See: https://dev.chartmogul.com/docs/import-customer
|
19
|
-
#
|
20
|
-
# options - The Hash options used to create a Customer (default: {}):
|
21
|
-
# :data_source_uuid - The String ChartMogul UUID of the data
|
22
|
-
# source that this customer comes from.
|
23
|
-
# :external_id - The String unique identifier specified by you for the customer.
|
24
|
-
# Typically an identifier from your internal system.
|
25
|
-
# Accepts alphanumeric characters.
|
26
|
-
# :name - The String name of the customer for display purposes.
|
27
|
-
# Accepts alphanumeric characters.
|
28
|
-
# :email - The String Email address of the customer (optional).
|
29
|
-
# :company - The String customer's company or organisation (optional).
|
30
|
-
# :country - The String Country code of customer's location
|
31
|
-
# as per ISO-3166 alpha-2 standard (optional).
|
32
|
-
# :state - The String State code of customer's location
|
33
|
-
# as per ISO-3166 alpha-2 standard (optional).
|
34
|
-
# :city - The String city of the customer's location (optional).
|
35
|
-
# :zip - The String zip code of the customer's location (optional).
|
36
|
-
#
|
37
|
-
# Returns the instance of Chartmogul::V1::Request.
|
38
|
-
def create(**options)
|
39
|
-
Chartmogul::V1::Request.new "#{BASE_URI}", options.merge(method: :post, userpwd: client.userpwd)
|
40
|
-
end
|
41
|
-
|
42
|
-
# Public: Get list Customers.
|
43
|
-
#
|
44
|
-
# See: https://dev.chartmogul.com/docs/list-all-imported-customers
|
45
|
-
#
|
46
|
-
# Returns the instance of Chartmogul::V1::Request.
|
47
|
-
def list
|
48
|
-
Chartmogul::V1::Request.new "#{BASE_URI}", userpwd: client.userpwd
|
49
|
-
end
|
10
|
+
Chartmogul::V1::Import::Customers.new(client)
|
50
11
|
end
|
51
12
|
|
52
13
|
end
|
53
14
|
end
|
54
15
|
end
|
16
|
+
|
17
|
+
require 'chartmogul/v1/import/customers'
|
data/lib/chartmogul/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chartmogul::V1::Import::Customers do
|
4
|
+
|
5
|
+
let(:client) { Chartmogul::Client.new }
|
6
|
+
|
7
|
+
describe '#invoices' do
|
8
|
+
subject { client.import.customers.invoices }
|
9
|
+
|
10
|
+
it { expect(subject).to be_a Chartmogul::V1::Import::Invoices }
|
11
|
+
it { expect(subject.client).to eq client }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#create' do
|
15
|
+
let(:url) { 'https://api.chartmogul.com/v1/import/customers' }
|
16
|
+
let(:query) { { foo: 'bar' } }
|
17
|
+
|
18
|
+
before do
|
19
|
+
stub_request(:post, url).with(query: query).to_return(status: 201)
|
20
|
+
end
|
21
|
+
|
22
|
+
subject { client.import.customers.create(query) }
|
23
|
+
|
24
|
+
it_should_behave_like 'a base ChartMogul API V1 requests', method: :post
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#list' do
|
28
|
+
let(:url) { 'https://api.chartmogul.com/v1/import/customers' }
|
29
|
+
let(:query) { { } }
|
30
|
+
|
31
|
+
before do
|
32
|
+
stub_request(:get, url).with(query: query).to_return(status: 200)
|
33
|
+
end
|
34
|
+
|
35
|
+
subject { client.import.customers.list }
|
36
|
+
|
37
|
+
it_should_behave_like 'a base ChartMogul API V1 requests'
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chartmogul::V1::Import::Invoices do
|
4
|
+
|
5
|
+
let(:client) { Chartmogul::Client.new }
|
6
|
+
|
7
|
+
describe '#create' do
|
8
|
+
let(:url) { 'https://api.chartmogul.com/v1/import/customers/customer-id/invoices' }
|
9
|
+
let(:query) { { foo: 'bar' } }
|
10
|
+
|
11
|
+
before do
|
12
|
+
stub_request(:post, url).with(query: query).to_return(status: 201)
|
13
|
+
end
|
14
|
+
|
15
|
+
subject { client.import.customers.invoices.create('customer-id', query) }
|
16
|
+
|
17
|
+
it_should_behave_like 'a base ChartMogul API V1 requests', method: :post
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -11,31 +11,4 @@ RSpec.describe Chartmogul::V1::Import do
|
|
11
11
|
it { expect(subject.client).to eq client }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe '::Customers' do
|
15
|
-
describe '#create' do
|
16
|
-
let(:url) { 'https://api.chartmogul.com/v1/import/customers' }
|
17
|
-
let(:query) { { foo: 'bar' } }
|
18
|
-
|
19
|
-
before do
|
20
|
-
stub_request(:post, url).with(query: query).to_return(status: 201)
|
21
|
-
end
|
22
|
-
|
23
|
-
subject { client.import.customers.create(query) }
|
24
|
-
|
25
|
-
it_should_behave_like 'a base ChartMogul API V1 requests', method: :post
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#list' do
|
29
|
-
let(:url) { 'https://api.chartmogul.com/v1/import/customers' }
|
30
|
-
let(:query) { { } }
|
31
|
-
|
32
|
-
before do
|
33
|
-
stub_request(:get, url).with(query: query).to_return(status: 200)
|
34
|
-
end
|
35
|
-
|
36
|
-
subject { client.import.customers.list }
|
37
|
-
|
38
|
-
it_should_behave_like 'a base ChartMogul API V1 requests'
|
39
|
-
end
|
40
|
-
end
|
41
14
|
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.2
|
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-03-
|
12
|
+
date: 2016-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -115,11 +115,15 @@ files:
|
|
115
115
|
- lib/chartmogul/v1/base.rb
|
116
116
|
- lib/chartmogul/v1/customers.rb
|
117
117
|
- lib/chartmogul/v1/import.rb
|
118
|
+
- lib/chartmogul/v1/import/customers.rb
|
119
|
+
- lib/chartmogul/v1/import/invoices.rb
|
118
120
|
- lib/chartmogul/v1/request.rb
|
119
121
|
- lib/chartmogul/version.rb
|
120
122
|
- lib/chartmogul_client.rb
|
121
123
|
- spec/chartmogul/client_spec.rb
|
122
124
|
- spec/chartmogul/v1/customers_spec.rb
|
125
|
+
- spec/chartmogul/v1/import/customers_spec.rb
|
126
|
+
- spec/chartmogul/v1/import/invoices_spec.rb
|
123
127
|
- spec/chartmogul/v1/import_spec.rb
|
124
128
|
- spec/spec_helper.rb
|
125
129
|
- spec/support/shared_examples/chartmogul_api_v1_examples.rb
|
@@ -150,6 +154,8 @@ summary: ChartMogul API wrapper
|
|
150
154
|
test_files:
|
151
155
|
- spec/chartmogul/client_spec.rb
|
152
156
|
- spec/chartmogul/v1/customers_spec.rb
|
157
|
+
- spec/chartmogul/v1/import/customers_spec.rb
|
158
|
+
- spec/chartmogul/v1/import/invoices_spec.rb
|
153
159
|
- spec/chartmogul/v1/import_spec.rb
|
154
160
|
- spec/spec_helper.rb
|
155
161
|
- spec/support/shared_examples/chartmogul_api_v1_examples.rb
|