nimbu-api 0.3.0 → 0.4.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 +5 -5
- data/.gitignore +1 -0
- data/lib/nimbu-api.rb +9 -0
- data/lib/nimbu-api/client.rb +8 -0
- data/lib/nimbu-api/connection.rb +4 -5
- data/lib/nimbu-api/endpoints/activities.rb +16 -0
- data/lib/nimbu-api/endpoints/channels.rb +23 -0
- data/lib/nimbu-api/endpoints/channels/entries.rb +20 -2
- data/lib/nimbu-api/endpoints/coupons.rb +50 -0
- data/lib/nimbu-api/endpoints/customers.rb +6 -0
- data/lib/nimbu-api/endpoints/devices.rb +60 -0
- data/lib/nimbu-api/endpoints/functions.rb +16 -0
- data/lib/nimbu-api/endpoints/jobs.rb +16 -0
- data/lib/nimbu-api/endpoints/orders.rb +30 -0
- data/lib/nimbu-api/endpoints/products.rb +6 -0
- data/lib/nimbu-api/endpoints/roles.rb +44 -0
- data/lib/nimbu-api/endpoints/translations.rb +50 -0
- data/lib/nimbu-api/endpoints/webhooks.rb +31 -0
- data/lib/nimbu-api/request/oauth2.rb +1 -2
- data/lib/nimbu-api/response/mashify.rb +5 -1
- data/lib/nimbu-api/version.rb +1 -1
- data/nimbu-api.gemspec +1 -1
- data/vendor/cacert.pem +1452 -2033
- metadata +16 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d5294252784e0860897d26a11750d1682e7941cbe3151d18665984e534c5ceb9
|
4
|
+
data.tar.gz: c31500b2d80101452c83c8e9a936f4a68ccba47b581ab9cf5c4b6ccfcf885e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3eef8c4f7f1c1b3700f9c3f7cc2ee43b7bc6cfe81bb3f6bf6ef7b18be080cf37b4da77f827eefea0fec40af759fe86f27a2c0aee7755ea034c924f3cfbf0746
|
7
|
+
data.tar.gz: 2f1e726f2a3310e70ebfab95f08351f144fae5f607ac32d75446870916e56c2beb03e6331335210eaa1de98da46cd1766a001a8e053d0d0a105d905db4cb6527
|
data/.gitignore
CHANGED
data/lib/nimbu-api.rb
CHANGED
@@ -24,12 +24,21 @@ require 'nimbu-api/endpoints/themes/layouts'
|
|
24
24
|
require 'nimbu-api/endpoints/themes/templates'
|
25
25
|
require 'nimbu-api/endpoints/themes/snippets'
|
26
26
|
require 'nimbu-api/endpoints/themes/assets'
|
27
|
+
require 'nimbu-api/endpoints/activities'
|
27
28
|
require 'nimbu-api/endpoints/channels'
|
28
29
|
require 'nimbu-api/endpoints/channels/entries'
|
29
30
|
require 'nimbu-api/endpoints/products'
|
30
31
|
require 'nimbu-api/endpoints/customers'
|
31
32
|
require 'nimbu-api/endpoints/collections'
|
33
|
+
require 'nimbu-api/endpoints/coupons'
|
32
34
|
require 'nimbu-api/endpoints/videos'
|
35
|
+
require 'nimbu-api/endpoints/devices'
|
36
|
+
require 'nimbu-api/endpoints/webhooks'
|
37
|
+
require 'nimbu-api/endpoints/translations'
|
38
|
+
require 'nimbu-api/endpoints/orders'
|
39
|
+
require 'nimbu-api/endpoints/functions'
|
40
|
+
require 'nimbu-api/endpoints/jobs'
|
41
|
+
require 'nimbu-api/endpoints/roles'
|
33
42
|
|
34
43
|
module Nimbu
|
35
44
|
extend Configuration
|
data/lib/nimbu-api/client.rb
CHANGED
@@ -42,6 +42,14 @@ module Nimbu
|
|
42
42
|
Nimbu::Builder.new('Collections', current_options.merge(options), &block)
|
43
43
|
end
|
44
44
|
|
45
|
+
def devices(options={}, &block)
|
46
|
+
Nimbu::Builder.new('Devices', current_options.merge(options), &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
def coupons(options={}, &block)
|
50
|
+
Nimbu::Builder.new('Coupons', current_options.merge(options), &block)
|
51
|
+
end
|
52
|
+
|
45
53
|
def authenticate(options={}, &block)
|
46
54
|
Nimbu::Builder.new('Login', current_options.merge(options), &block).response
|
47
55
|
end
|
data/lib/nimbu-api/connection.rb
CHANGED
@@ -16,8 +16,7 @@ module Nimbu
|
|
16
16
|
def default_options(options={})
|
17
17
|
{
|
18
18
|
:ssl => options.fetch(:ssl) { ssl },
|
19
|
-
:url => options.fetch(:endpoint) { Nimbu.endpoint }
|
20
|
-
:subdomain => options.fetch(:subdomain) { Nimbu.subdomain }
|
19
|
+
:url => options.fetch(:endpoint) { Nimbu.endpoint }
|
21
20
|
}.merge(options)
|
22
21
|
end
|
23
22
|
|
@@ -65,9 +64,9 @@ module Nimbu
|
|
65
64
|
def stack(options={}, &block)
|
66
65
|
@stack ||= begin
|
67
66
|
if block_given?
|
68
|
-
Faraday::
|
67
|
+
Faraday::RackBuilder.new(&block)
|
69
68
|
else
|
70
|
-
Faraday::
|
69
|
+
Faraday::RackBuilder.new(&default_middleware(options))
|
71
70
|
end
|
72
71
|
end
|
73
72
|
end
|
@@ -75,7 +74,7 @@ module Nimbu
|
|
75
74
|
# Returns a Fraday::Connection object
|
76
75
|
#
|
77
76
|
def connection(options={})
|
78
|
-
conn_options = default_options(options)
|
77
|
+
conn_options = default_options(options).keep_if {|k,_| ALLOWED_OPTIONS.include? k }
|
79
78
|
clear_cache unless options.empty?
|
80
79
|
puts "OPTIONS:#{conn_options.inspect}" if ENV['DEBUG']
|
81
80
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Activities < Endpoint
|
6
|
+
|
7
|
+
def get(*args)
|
8
|
+
arguments(args, :required => [:activity_id])
|
9
|
+
|
10
|
+
get_request("/activities/#{activity_id}", arguments.params)
|
11
|
+
end
|
12
|
+
alias :find :get
|
13
|
+
|
14
|
+
end # Authorizations
|
15
|
+
end # Endpoints
|
16
|
+
end # Nimbu
|
@@ -18,6 +18,12 @@ module Nimbu
|
|
18
18
|
end
|
19
19
|
alias :all :list
|
20
20
|
|
21
|
+
def first(*args)
|
22
|
+
arguments(args)
|
23
|
+
|
24
|
+
get_request("/channels", arguments.params.merge(limit: 1)).first
|
25
|
+
end
|
26
|
+
|
21
27
|
def get(*args)
|
22
28
|
arguments(args, :required => [:channel_id])
|
23
29
|
|
@@ -25,6 +31,23 @@ module Nimbu
|
|
25
31
|
end
|
26
32
|
alias :find :get
|
27
33
|
|
34
|
+
def webhooks(*args)
|
35
|
+
arguments(args, :required => [:channel_id])
|
36
|
+
|
37
|
+
get_request("/channels/#{channel_id}/webhooks", arguments.params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_webhook(*args)
|
41
|
+
arguments(args, :required => [:channel_id])
|
42
|
+
|
43
|
+
post_request("/channels/#{channel_id}/webhooks", arguments.params)
|
44
|
+
end
|
45
|
+
|
46
|
+
def poll_webhook(*args)
|
47
|
+
arguments(args, :required => [:channel_id])
|
48
|
+
|
49
|
+
post_request("/channels/#{channel_id}/webhooks/poll", arguments.params)
|
50
|
+
end
|
28
51
|
|
29
52
|
end # Authorizations
|
30
53
|
end # Endpoints
|
@@ -17,6 +17,25 @@ module Nimbu
|
|
17
17
|
end
|
18
18
|
alias :all :list
|
19
19
|
|
20
|
+
def first(*args)
|
21
|
+
arguments(args, :required => [:channel_id])
|
22
|
+
|
23
|
+
get_request("/channels/#{channel_id}/entries", arguments.params.merge(limit: 1)).first
|
24
|
+
end
|
25
|
+
|
26
|
+
def list_deleted(*args)
|
27
|
+
arguments(args, :required => [:channel_id])
|
28
|
+
|
29
|
+
get_request("/channels/#{channel_id}/entries/deleted", arguments.params)
|
30
|
+
end
|
31
|
+
alias :list_removed :list_deleted
|
32
|
+
|
33
|
+
def count(*args)
|
34
|
+
arguments(args, :required => [:channel_id])
|
35
|
+
|
36
|
+
get_request("/channels/#{channel_id}/entries/count", arguments.params)
|
37
|
+
end
|
38
|
+
|
20
39
|
def get(*args)
|
21
40
|
arguments(args, :required => [:channel_id, :entry_id])
|
22
41
|
|
@@ -43,8 +62,7 @@ module Nimbu
|
|
43
62
|
delete_request("/channels/#{channel_id}/entries/#{entry_id}", arguments.params)
|
44
63
|
end
|
45
64
|
alias :remove :delete
|
46
|
-
|
47
|
-
|
65
|
+
|
48
66
|
end # Channel::Entries
|
49
67
|
end # Endpoints
|
50
68
|
end # Nimbu
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Coupons < Endpoint
|
6
|
+
def list(*args)
|
7
|
+
arguments(args)
|
8
|
+
|
9
|
+
response = get_request("/coupons", arguments.params)
|
10
|
+
return response unless block_given?
|
11
|
+
response.each { |el| yield el }
|
12
|
+
end
|
13
|
+
alias :all :list
|
14
|
+
|
15
|
+
def count(*args)
|
16
|
+
arguments(args)
|
17
|
+
|
18
|
+
get_request("/coupons/count", arguments.params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get(*args)
|
22
|
+
arguments(args, :required => [:coupon_id])
|
23
|
+
|
24
|
+
get_request("/coupons/#{coupon_id}", arguments.params)
|
25
|
+
end
|
26
|
+
alias :find :get
|
27
|
+
|
28
|
+
def create(*args)
|
29
|
+
arguments(args)
|
30
|
+
|
31
|
+
post_request("/coupons", arguments.params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(*args)
|
35
|
+
arguments(args, :required => [:coupon_id])
|
36
|
+
|
37
|
+
patch_request("/coupons/#{coupon_id}", arguments.params)
|
38
|
+
end
|
39
|
+
alias :edit :update
|
40
|
+
|
41
|
+
def delete(*args)
|
42
|
+
arguments(args, :required => [:coupon_id])
|
43
|
+
|
44
|
+
delete_request("/coupons/#{coupon_id}", arguments.params)
|
45
|
+
end
|
46
|
+
alias :remove :delete
|
47
|
+
|
48
|
+
end # Products
|
49
|
+
end # Endpoints
|
50
|
+
end # Nimbu
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Devices < Endpoint
|
6
|
+
def list(*args)
|
7
|
+
arguments(args)
|
8
|
+
|
9
|
+
response = get_request("/devices", arguments.params)
|
10
|
+
return response unless block_given?
|
11
|
+
response.each { |el| yield el }
|
12
|
+
end
|
13
|
+
alias :all :list
|
14
|
+
|
15
|
+
def count(*args)
|
16
|
+
arguments(args)
|
17
|
+
|
18
|
+
get_request("/devices/count", arguments.params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get(*args)
|
22
|
+
arguments(args, :required => [:device_id])
|
23
|
+
|
24
|
+
get_request("/devices/#{device_id}", arguments.params)
|
25
|
+
end
|
26
|
+
alias :find :get
|
27
|
+
|
28
|
+
def create(*args)
|
29
|
+
arguments(args)
|
30
|
+
|
31
|
+
post_request("/devices", arguments.params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(*args)
|
35
|
+
arguments(args, :required => [:device_id])
|
36
|
+
|
37
|
+
patch_request("/devices/#{device_id}", arguments.params)
|
38
|
+
end
|
39
|
+
alias :edit :update
|
40
|
+
|
41
|
+
def delete(*args)
|
42
|
+
arguments(args, :required => [:device_id])
|
43
|
+
|
44
|
+
delete_request("/devices/#{device_id}", arguments.params)
|
45
|
+
end
|
46
|
+
alias :remove :delete
|
47
|
+
|
48
|
+
def push(*args)
|
49
|
+
arguments(args)
|
50
|
+
|
51
|
+
query_params = arguments.params.delete("query")
|
52
|
+
data = arguments.params
|
53
|
+
|
54
|
+
post_request("/devices/push", data, params: query_params)
|
55
|
+
end
|
56
|
+
alias :message :push
|
57
|
+
|
58
|
+
end # Devices
|
59
|
+
end # Endpoints
|
60
|
+
end # Nimbu
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Functions < Endpoint
|
6
|
+
|
7
|
+
def run(*args)
|
8
|
+
arguments(args, :required => [:function_id])
|
9
|
+
|
10
|
+
post_request("/functions/#{function_id}", arguments.params)
|
11
|
+
return response
|
12
|
+
end
|
13
|
+
|
14
|
+
end # Simulator
|
15
|
+
end # Endpoints
|
16
|
+
end # Nimbu
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Jobs < Endpoint
|
6
|
+
|
7
|
+
def schedule(*args)
|
8
|
+
arguments(args, :required => [:job_id])
|
9
|
+
|
10
|
+
post_request("/jobs/#{job_id}", arguments.params)
|
11
|
+
return response
|
12
|
+
end
|
13
|
+
|
14
|
+
end # Simulator
|
15
|
+
end # Endpoints
|
16
|
+
end # Nimbu
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Orders < Endpoint
|
6
|
+
def list(*args)
|
7
|
+
arguments(args)
|
8
|
+
|
9
|
+
response = get_request("/orders", arguments.params)
|
10
|
+
return response unless block_given?
|
11
|
+
response.each { |el| yield el }
|
12
|
+
end
|
13
|
+
alias :all :list
|
14
|
+
|
15
|
+
def get(*args)
|
16
|
+
arguments(args, :required => [:order_id])
|
17
|
+
|
18
|
+
get_request("/orders/#{order_id}", arguments.params)
|
19
|
+
end
|
20
|
+
alias :find :get
|
21
|
+
|
22
|
+
def count(*args)
|
23
|
+
arguments(args)
|
24
|
+
|
25
|
+
get_request("/orders/count", arguments.params)
|
26
|
+
end
|
27
|
+
|
28
|
+
end # Orders
|
29
|
+
end # Endpoints
|
30
|
+
end # Nimbu
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Roles < Endpoint
|
6
|
+
def list(*args)
|
7
|
+
arguments(args)
|
8
|
+
|
9
|
+
response = get_request("/roles", arguments.params)
|
10
|
+
return response unless block_given?
|
11
|
+
response.each { |el| yield el }
|
12
|
+
end
|
13
|
+
alias :all :list
|
14
|
+
|
15
|
+
def get(*args)
|
16
|
+
arguments(args, :required => [:role_id])
|
17
|
+
|
18
|
+
get_request("/roles/#{role_id}", arguments.params)
|
19
|
+
end
|
20
|
+
alias :find :get
|
21
|
+
|
22
|
+
def create(*args)
|
23
|
+
arguments(args)
|
24
|
+
|
25
|
+
post_request("/roles", arguments.params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(*args)
|
29
|
+
arguments(args, :required => [:role_id])
|
30
|
+
|
31
|
+
patch_request("/roles/#{role_id}", arguments.params)
|
32
|
+
end
|
33
|
+
alias :edit :update
|
34
|
+
|
35
|
+
def delete(*args)
|
36
|
+
arguments(args, :required => [:role_id])
|
37
|
+
|
38
|
+
delete_request("/roles/#{role_id}", arguments.params)
|
39
|
+
end
|
40
|
+
alias :remove :delete
|
41
|
+
|
42
|
+
end # Roles
|
43
|
+
end # Endpoints
|
44
|
+
end # Nimbu
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nimbu
|
4
|
+
module Endpoints
|
5
|
+
class Translations < Endpoint
|
6
|
+
def list(*args)
|
7
|
+
arguments(args)
|
8
|
+
|
9
|
+
response = get_request("/translations", arguments.params)
|
10
|
+
return response unless block_given?
|
11
|
+
response.each { |el| yield el }
|
12
|
+
end
|
13
|
+
alias :all :list
|
14
|
+
|
15
|
+
def get(*args)
|
16
|
+
arguments(args, :required => [:translation_id])
|
17
|
+
|
18
|
+
get_request("/translations/#{translation_id}", arguments.params)
|
19
|
+
end
|
20
|
+
alias :find :get
|
21
|
+
|
22
|
+
def count(*args)
|
23
|
+
arguments(args)
|
24
|
+
|
25
|
+
get_request("/translations/count", arguments.params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create(*args)
|
29
|
+
arguments(args)
|
30
|
+
|
31
|
+
post_request("/translations", arguments.params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(*args)
|
35
|
+
arguments(args, :required => [:translation_id])
|
36
|
+
|
37
|
+
patch_request("/translations/#{translation_id}", arguments.params)
|
38
|
+
end
|
39
|
+
alias :edit :update
|
40
|
+
|
41
|
+
def delete(*args)
|
42
|
+
arguments(args, :required => [:translation_id])
|
43
|
+
|
44
|
+
delete_request("/translations/#{translation_id}", arguments.params)
|
45
|
+
end
|
46
|
+
alias :remove :delete
|
47
|
+
|
48
|
+
end # Translations
|
49
|
+
end # Endpoints
|
50
|
+
end # Nimbu
|