esp_sdk 1.0.2 → 1.0.3
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 +4 -4
- data/README.md +60 -43
- data/lib/esp_sdk/end_points/base.rb +10 -6
- data/lib/esp_sdk/version.rb +1 -1
- data/test/esp_sdk/end_points/base_test.rb +37 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c52d23d423160230bb03f5d2b126c428f5d8b100
|
4
|
+
data.tar.gz: acebf34428219913ae23155ba4f273307c3c66d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c61bdcd07beca80268a66b01c12d7be7ab1aec31a7d3522f3e425804a6096936683e358930f4304dde5b68b95597ec16f608c527719a1b13fb5ac2b164e1682
|
7
|
+
data.tar.gz: 641b7be183bae8eec78d9bf70c314563b213793d651f78ad7934e7aa5f41474d05c105fad4ecc8f68e4a667c37b16511d732d27b8e86bf6ff0fc792888365233
|
data/README.md
CHANGED
@@ -571,29 +571,30 @@ Or install it yourself as:
|
|
571
571
|
|
572
572
|
## External Accounts end point
|
573
573
|
### List action
|
574
|
-
# list is a pageable response of 25 total external accounts per page
|
575
|
-
api.external_accounts.list =>
|
576
|
-
[
|
577
|
-
[0] {
|
578
|
-
"id" => 1,
|
579
|
-
"created_at" => "2014-10-22T16:23:19.615Z",
|
580
|
-
"updated_at" => "2014-11-03T21:39:36.891Z",
|
581
|
-
"organization_id" => 1,
|
582
|
-
"nickname" => "Ops",
|
583
|
-
"team_id" => 1,
|
584
|
-
"sub_organization_id" => 1,
|
585
|
-
"arn" => "arn:aws:iam::12345:role/evident_service_role",
|
586
|
-
"external_id" => "External ID"
|
587
|
-
}
|
588
|
-
]
|
589
|
-
# Current page
|
590
|
-
api.external_accounts.current_page
|
591
574
|
|
592
|
-
|
593
|
-
|
575
|
+
# list is a pageable response of 25 total external accounts per page
|
576
|
+
api.external_accounts.list =>
|
577
|
+
[
|
578
|
+
[0] {
|
579
|
+
"id" => 1,
|
580
|
+
"created_at" => "2014-10-22T16:23:19.615Z",
|
581
|
+
"updated_at" => "2014-11-03T21:39:36.891Z",
|
582
|
+
"organization_id" => 1,
|
583
|
+
"nickname" => "Ops",
|
584
|
+
"team_id" => 1,
|
585
|
+
"sub_organization_id" => 1,
|
586
|
+
"arn" => "arn:aws:iam::12345:role/evident_service_role",
|
587
|
+
"external_id" => "External ID"
|
588
|
+
}
|
589
|
+
]
|
590
|
+
# Current page
|
591
|
+
api.external_accounts.current_page
|
594
592
|
|
595
|
-
|
596
|
-
|
593
|
+
# Next page sets current page with the next page results.
|
594
|
+
api.external_accounts.next_page
|
595
|
+
|
596
|
+
# Prev page sets current page with the previous page results.
|
597
|
+
api.external_accounts.prev_page
|
597
598
|
|
598
599
|
### Show action
|
599
600
|
# Show a specific external account
|
@@ -615,32 +616,48 @@ Or install it yourself as:
|
|
615
616
|
api.external_accounts.current_record
|
616
617
|
|
617
618
|
### Update action
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
619
|
+
# Update a specific external account
|
620
|
+
# Required :id
|
621
|
+
api.external_accounts.update(id: 1, nickname: 'Dev Ops') =>
|
622
|
+
{
|
623
|
+
"id" => 1,
|
624
|
+
"created_at" => "2014-10-22T16:23:19.615Z",
|
625
|
+
"updated_at" => "2014-11-03T21:39:36.891Z",
|
626
|
+
"organization_id" => 1,
|
627
|
+
"nickname" => "Dev Ops",
|
628
|
+
"team_id" => 1,
|
629
|
+
"sub_organization_id" => 1,
|
630
|
+
"arn" => "arn:aws:iam::12345:role/evident_service_role",
|
631
|
+
"external_id" => "External ID"
|
632
|
+
}
|
632
633
|
|
633
634
|
### Destroy action
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
635
|
+
# Destroy a specific external account
|
636
|
+
# Required :id
|
637
|
+
api.external_accounts.destroy(id: 1) =>
|
638
|
+
{
|
639
|
+
"success" => "Dev Ops has been destroyed"
|
640
|
+
}
|
640
641
|
|
641
642
|
### Create action
|
642
|
-
|
643
|
-
|
643
|
+
# Create a new external account
|
644
|
+
Required: :arn, :external_id, :sub_organization_id, :team_id
|
645
|
+
api.external_accounts.create(arn: 'arn:aws:iam::12345:role/evident_service_role',
|
646
|
+
external_id: 'External ID',
|
647
|
+
nickname: 'Dev ops',
|
648
|
+
sub_organization_id: 1,
|
649
|
+
team_id: 1) =>
|
650
|
+
{
|
651
|
+
"id" => 3,
|
652
|
+
"created_at" => "2014-11-24T15:37:35.249Z",
|
653
|
+
"updated_at" => "2014-11-24T15:37:35.249Z",
|
654
|
+
"organization_id" => 1,
|
655
|
+
"nickname" => "Dev Ops",
|
656
|
+
"team_id" => 1,
|
657
|
+
"sub_organization_id" => 1,
|
658
|
+
"arn" => "arn:aws:iam::12345:role/evident_service_role",
|
659
|
+
"external_id" => "External ID"
|
660
|
+
}
|
644
661
|
|
645
662
|
|
646
663
|
## Services end point
|
@@ -11,9 +11,9 @@ module EspSdk
|
|
11
11
|
if @page_links['next'].present?
|
12
12
|
response = connect(@page_links['next'], :get)
|
13
13
|
pagination_links(response)
|
14
|
-
|
14
|
+
self.current_page = JSON.load(response.body)
|
15
15
|
else
|
16
|
-
current_page
|
16
|
+
@current_page
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -23,7 +23,7 @@ module EspSdk
|
|
23
23
|
if @page_links['prev'].present?
|
24
24
|
response = connect(@page_links['prev'], :get)
|
25
25
|
pagination_links(response)
|
26
|
-
|
26
|
+
self.current_page = JSON.load(response.body)
|
27
27
|
else
|
28
28
|
@current_page
|
29
29
|
end
|
@@ -33,7 +33,7 @@ module EspSdk
|
|
33
33
|
def list
|
34
34
|
response = connect(base_url, :get)
|
35
35
|
pagination_links(response)
|
36
|
-
|
36
|
+
self.current_page = JSON.load(response.body)
|
37
37
|
end
|
38
38
|
|
39
39
|
# Get a single record
|
@@ -75,11 +75,15 @@ module EspSdk
|
|
75
75
|
|
76
76
|
def submit(url, type, options = {})
|
77
77
|
response = connect(url, type, options)
|
78
|
-
@current_record = JSON.load(response.body)
|
78
|
+
@current_record = ActiveSupport::HashWithIndifferentAccess.new(JSON.load(response.body))
|
79
79
|
end
|
80
80
|
|
81
81
|
def pagination_links(response)
|
82
|
-
@page_links = JSON.load(response.headers[:link])
|
82
|
+
@page_links = ActiveSupport::HashWithIndifferentAccess.new(JSON.load(response.headers[:link]))
|
83
|
+
end
|
84
|
+
|
85
|
+
def current_page=(value)
|
86
|
+
@current_page = ActiveSupport::HashWithIndifferentAccess.new(value)
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
data/lib/esp_sdk/version.rb
CHANGED
@@ -171,5 +171,41 @@ class BaseTest < ActiveSupport::TestCase
|
|
171
171
|
assert_equal 'https://api.evident.io/api/v1/external_accounts', external_account.send(:base_url)
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
context 'current_page' do
|
176
|
+
setup do
|
177
|
+
# Setup fakeweb
|
178
|
+
FakeWeb.register_uri(:get, /api\/v1\/base/, body: { stub: 'Stub' }.to_json)
|
179
|
+
@base.list
|
180
|
+
end
|
181
|
+
|
182
|
+
should 'be ActiveSupport::HashWithIndifferentAccess' do
|
183
|
+
assert @base.current_page.is_a?(ActiveSupport::HashWithIndifferentAccess)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'current_record' do
|
188
|
+
setup do
|
189
|
+
# Setup fakeweb
|
190
|
+
FakeWeb.register_uri(:get, /api\/v1\/base\/1/, body: { stub: 'Stub' }.to_json)
|
191
|
+
@base.show(id: 1)
|
192
|
+
end
|
193
|
+
|
194
|
+
should 'be ActiveSupport::HashWithIndifferentAccess' do
|
195
|
+
assert @base.current_record.is_a?(ActiveSupport::HashWithIndifferentAccess)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context 'page_links' do
|
200
|
+
setup do
|
201
|
+
# Setup fakeweb
|
202
|
+
FakeWeb.register_uri(:get, /api\/v1\/base/, body: { stub: 'Stub' }.to_json)
|
203
|
+
@base.list
|
204
|
+
end
|
205
|
+
|
206
|
+
should 'be ActiveSupport::HashWithIndifferentAccess' do
|
207
|
+
assert @base.instance_variable_get(:@page_links).is_a?(ActiveSupport::HashWithIndifferentAccess)
|
208
|
+
end
|
209
|
+
end
|
174
210
|
end
|
175
|
-
end
|
211
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esp_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evident.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|