clientside_aws 0.0.23 → 0.0.24

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: 212e6dd842f718ed8cd4e1601348f2705dfbae0b
4
- data.tar.gz: cd0fcf3aad613d98713d0e974dd3d999ddb4a72c
3
+ metadata.gz: fa4605924db8e40740bbe014617f533b9a0ddc50
4
+ data.tar.gz: 4c9c9f6e90281a6dbff7e03d9d1851f5d950d501
5
5
  SHA512:
6
- metadata.gz: 8f8380aab2765db7790d046d34a09dd1d76167779d2af57f2602256950671c4e039ede96724787c34259ed30bee8340183129c4632316f163033c7445ab8eaee
7
- data.tar.gz: a3ea6a6eecbfdc8e94ac6f8e1e2181d9b2442f4802becab0f613f635cfa855f2f619a162759175dc0e4004c38e6b74fa0d6d8cd71e1d26b9baef29de37e9a415
6
+ metadata.gz: 186e49b50aea5a13d9819213d82942c07d5dcbe6bb6203e22b982515503a557580f7675397760fb157f6e903c29a7cbec756fa4a51cdb5103a6f0a18a994108b
7
+ data.tar.gz: 52f690874266a4bec8892b33e8a4099c8213a6872ababbd54041f9eecf6bab39d70b4c369cb0176e3e91562034925c3da1dd5f2219b0487780d597bf369fabf3
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
6
6
  # not for our Gemfile which points clients to our docker image
7
7
  gem 'aws-sdk', '2.10.26'
8
8
  gem 'aws-sdk-v1', '1.66.0'
9
- gem 'builder', '3.1.4'
9
+ gem 'builder', '~> 3.2'
10
10
  gem 'httparty', '0.15.6'
11
11
  gem 'json', '1.8.6'
12
12
  gem 'json_pure', '1.8.6'
@@ -15,8 +15,8 @@ gem 'pry'
15
15
  gem 'rack', '1.5.2'
16
16
  gem 'rack-cors', '0.2.9', require: 'rack/cors'
17
17
  gem 'rack-test', '0.5.7'
18
- gem 'redis', '3.2.0'
19
- gem 'rspec', '2.14.1'
18
+ gem 'redis', '~> 4.0'
19
+ gem 'rspec', '~> 3.0'
20
20
  gem 'sinatra', '1.4.8'
21
21
  gem 'sinatra-reloader', '0.5.0'
22
22
  gem 'webmock', '3.1.0'
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'httparty', '~> 0.15'
28
28
  spec.add_dependency 'json', '~> 1.8'
29
29
  spec.add_dependency 'webmock', '~> 3.1'
30
- spec.add_dependency 'rspec', '~> 2.14'
30
+ spec.add_dependency 'rspec', '~> 3.0'
31
31
  end
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'aws-sdk', '2.10.26'
4
3
  gem 'sinatra', '1.4.8'
5
- gem 'webmock', '3.1.0'
6
4
  gem 'clientside_aws'
@@ -19,12 +19,19 @@ post '/image' do
19
19
 
20
20
  bucket = Aws::S3::Resource.new.bucket('test')
21
21
 
22
- # Now, store a JSON document
22
+ # Now, store an image
23
23
  object = bucket.object('image')
24
- object.put(body: params['data'], content_type: 'image/jpeg')
24
+ file = File.open(params[:image][:tempfile].path, 'rb')
25
+ image = file.read
26
+ file.close
27
+
28
+ object.put(body: image, content_type: 'image/jpeg')
29
+
30
+ redirect '/'
25
31
  end
26
32
 
27
33
  get '/image' do
34
+ bucket = Aws::S3::Resource.new.bucket('test')
28
35
  object = bucket.object('image')
29
36
 
30
37
  content_type 'image/jpeg'
@@ -1,11 +1,11 @@
1
1
  <html>
2
2
  <head>
3
- <title>Clientside AWS Test</title>
3
+ <title>clientside_aws test app</title>
4
4
  </head>
5
5
  <body>
6
- <p>
7
- Upload an image
8
- </p>
6
+ <h1>
7
+ Upload an image to clientside_aws S3
8
+ </h1>
9
9
  <p>
10
10
  <form method='post' action='/image' enctype='multipart/form-data'>
11
11
  File: <input type="file" name="image" id="image"/>
@@ -13,7 +13,7 @@
13
13
  </form>
14
14
  </p>
15
15
  <hr>
16
- <p>Here is the image:</p>
16
+ <h1>Here is the image, loaded directly from clientside_aws S3:</h1>
17
17
  <image src='/image' />
18
18
  </body>
19
19
  </html>
@@ -1,15 +1,17 @@
1
1
  version: '2'
2
2
  services:
3
- app:
3
+ app:
4
4
  image: clientside_aws_test_app
5
5
  container_name: clientside_aws_test_app
6
6
  links:
7
7
  - aws
8
- build:
8
+ build:
9
9
  context: ./
10
10
  dockerfile: ./Dockerfile
11
11
  command:
12
12
  /sbin/my_init
13
+ ports:
14
+ - '4567'
13
15
  aws:
14
16
  image: clientside_aws:latest
15
17
  container_name: clientside_aws_test_aws
@@ -19,4 +21,3 @@ services:
19
21
  command: /sbin/my_init
20
22
  ports:
21
23
  - '4567'
22
-
@@ -1,8 +1,5 @@
1
1
  require 'rubygems'
2
- require 'aws-sdk-v1'
3
- require 'aws-sdk'
4
2
  require 'clientside_aws'
5
- require 'pry'
6
3
 
7
4
  ClientsideAws.configure do |config|
8
5
  config.host = 'localhost'
@@ -16,30 +13,19 @@ config = { region: 'us-mockregion-1',
16
13
  Aws.config.update(config)
17
14
  AWS.config(config)
18
15
 
16
+ s3 = Aws::S3::Client.new
17
+ s3.create_bucket(bucket: 'test')
19
18
 
20
- # s3 = Aws::S3::Client.new
21
- # s3.create_bucket(bucket: 'test')
19
+ bucket = Aws::S3::Resource.new.bucket('test')
22
20
 
23
- # bucket = Aws::S3::Resource.new.bucket('test')
21
+ # Now, store a JSON document
22
+ json_value = { foo: 'bar' }.to_json
23
+ object = bucket.object('test.json')
24
+ object.put(body: json_value, content_type: 'application/json')
24
25
 
25
- # # Now, store a JSON document
26
- # json_value = { foo: 'bar' }.to_json
27
- # object = bucket.object('test.json')
28
- # object.put(body: json_value, content_type: 'application/json')
26
+ object = bucket.object('test.json')
29
27
 
30
- # object = bucket.object('test.json')
28
+ puts object.get.body.read
31
29
 
32
- # puts object.get.body.read
33
-
34
- AWS::ElasticTranscoder::Client.new.create_pipeline(
35
- name: 'SCRUFF_CHAT_VIDEO',
36
- input_bucket: 'foo',
37
- output_bucket: 'bar',
38
- role: '...',
39
- notifications: {
40
- progressing: '',
41
- completed: '',
42
- warning: '',
43
- error: '' })
44
30
 
45
31
  puts "Done"
@@ -1,3 +1,3 @@
1
1
  module ClientsideAws
2
- VERSION = '0.0.23'.freeze
2
+ VERSION = '0.0.24'.freeze
3
3
  end
@@ -28,7 +28,6 @@ describe 'Profiles Spec' do
28
28
 
29
29
  expect(dynamo_db.tables.to_a.length).to eq 1
30
30
  expect(dynamo_db.tables['test1'].exists?).to be true
31
- # dynamo_db.tables['test_fake'].exists?.should be_false # this test fails for some reason
32
31
 
33
32
  test_table.hash_key = [:creator_id, :number]
34
33
  test_table.range_key = [:date, :number]
@@ -203,14 +202,14 @@ describe 'Profiles Spec' do
203
202
  ct = 0
204
203
  results = visitors_table.items.query(hash_value: 1, scan_index_forward: false)
205
204
  results.to_a.each do |item|
206
- item.attributes['target_id'].to_i.should == 10 + ct
205
+ expect(item.attributes['target_id'].to_i).to eq 10 + ct
207
206
  ct += 1
208
207
  end
209
208
 
210
209
  ct = 0
211
210
  results = visitors_table.items.query(hash_value: 1)
212
211
  results.to_a.each do |item|
213
- item.attributes['target_id'].to_i.should == 20 - ct
212
+ expect(item.attributes['target_id'].to_i).to eq 20 - ct
214
213
  ct += 1
215
214
  end
216
215
 
@@ -226,7 +225,7 @@ describe 'Profiles Spec' do
226
225
  visitors2_table.items.put(profile_id: idx, date_profile: "#{timestamp}:#{profile_id}", target_id: profile_id)
227
226
  end
228
227
  results = visitors2_table.items.query(hash_value: 1)
229
- results.to_a.length.should == 1
228
+ expect(results.to_a.length).to eq 1
230
229
  end
231
230
 
232
231
  it 'v2: test vistors' do
@@ -421,7 +420,7 @@ describe 'Profiles Spec' do
421
420
  ]
422
421
  }
423
422
  })
424
- results[:member].length.should == 1
423
+ expect(results[:member].length).to eq 1
425
424
 
426
425
  dynamo_db.delete_item(table_name: 'cd_table', key: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' } })
427
426
 
@@ -443,7 +442,7 @@ describe 'Profiles Spec' do
443
442
  ]
444
443
  }
445
444
  })
446
- results[:member].length.should == 0
445
+ expect(results[:member].length.zero?).to be true
447
446
  end
448
447
 
449
448
  it 'v2: should handle create, delete' do
@@ -583,25 +582,25 @@ describe 'Profiles Spec' do
583
582
  dynamo_db.put_item(table_name: 'visited_by', item: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' },
584
583
  'timestamp' => { 'n' => 3.to_s } })
585
584
  item = dynamo_db.get_item(table_name: 'visited_by', key: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' } })
586
- item.should_not be_nil
587
- item[:item]['profile_id'][:n].should == '1'
588
- item[:item]['timestamp'][:n].should == '3'
585
+ expect(item).not_to be_nil
586
+ expect(item[:item]['profile_id'][:n]).to eq '1'
587
+ expect(item[:item]['timestamp'][:n]).to eq '3'
589
588
 
590
589
  # 2 visits 1 again
591
590
  dynamo_db.put_item(table_name: 'visited_by', item: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' },
592
591
  'timestamp' => { 'n' => 4.to_s } })
593
592
  item = dynamo_db.get_item(table_name: 'visited_by', key: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' } })
594
- item.should_not be_nil
595
- item[:item]['profile_id'][:n].should == '1'
596
- item[:item]['timestamp'][:n].should == '4'
593
+ expect(item).not_to be_nil
594
+ expect(item[:item]['profile_id'][:n]).to eq '1'
595
+ expect(item[:item]['timestamp'][:n]).to eq '4'
597
596
 
598
597
  # 2 visits 1 a third time, with timestamp of now
599
598
  dynamo_db.put_item(table_name: 'visited_by', item: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' },
600
599
  'timestamp' => { 'n' => now.to_s } })
601
600
 
602
601
  item = dynamo_db.get_item(table_name: 'visited_by', key: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '2' } })
603
- item.should_not be_nil
604
- item[:item]['profile_id'][:n].should == '1'
602
+ expect(item).not_to be_nil
603
+ expect(item[:item]['profile_id'][:n]).to eq '1'
605
604
 
606
605
  item = dynamo_db.get_item(table_name: 'visited_by', key: { 'profile_id' => { 'n' => '2' }, 'visitor_id' => { 'n' => '2' } })
607
606
  expect(item[:item]).to be_nil
@@ -621,7 +620,7 @@ describe 'Profiles Spec' do
621
620
  ]
622
621
  }
623
622
  })
624
- results[:member].length.should == 1
623
+ expect(results[:member].length).to eq 1
625
624
 
626
625
  # Try the local secondary index
627
626
  results = dynamo_db.query(table_name: 'visited_by', index_name: 'ls_index', select: 'ALL_PROJECTED_ATTRIBUTES', key_conditions: {
@@ -638,7 +637,7 @@ describe 'Profiles Spec' do
638
637
  ]
639
638
  }
640
639
  })
641
- results[:member].length.should == 1
640
+ expect(results[:member].length).to eq 1
642
641
 
643
642
  results = dynamo_db.query(table_name: 'visited_by', index_name: 'ls_index', select: 'ALL_PROJECTED_ATTRIBUTES', key_conditions: {
644
643
  'profile_id' => {
@@ -654,7 +653,7 @@ describe 'Profiles Spec' do
654
653
  ]
655
654
  }
656
655
  })
657
- results[:member].length.should == 0
656
+ expect(results[:member].length).to eq 0
658
657
 
659
658
  dynamo_db.put_item(table_name: 'visited_by', item: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '3' }, 'timestamp' => { 'n' => Time.now.utc.to_i.to_s } })
660
659
  dynamo_db.put_item(table_name: 'visited_by', item: { 'profile_id' => { 'n' => '1' }, 'visitor_id' => { 'n' => '4' }, 'timestamp' => { 'n' => Time.now.utc.to_i.to_s } })
@@ -673,7 +672,7 @@ describe 'Profiles Spec' do
673
672
  ]
674
673
  }
675
674
  })
676
- results[:member].length.should == 3
675
+ expect(results[:member].length).to eq 3
677
676
 
678
677
  # Add some more profiles visited by 2
679
678
  (3...10).each do |idx|
@@ -695,9 +694,9 @@ describe 'Profiles Spec' do
695
694
  ]
696
695
  }
697
696
  })
698
- results[:member].length.should == 8
699
- results[:member].first['profile_id'][:n].should == '9'
700
- results[:member].last['profile_id'][:n].should == '1'
697
+ expect(results[:member].length).to eq 8
698
+ expect(results[:member].first['profile_id'][:n]).to eq '9'
699
+ expect(results[:member].last['profile_id'][:n]).to eq '1'
701
700
 
702
701
  # reverse
703
702
  results = dynamo_db.query(table_name: 'visited_by',
@@ -716,9 +715,9 @@ describe 'Profiles Spec' do
716
715
  ]
717
716
  }
718
717
  })
719
- results[:member].length.should == 8
720
- results[:member].first['profile_id'][:n].should == '1'
721
- results[:member].last['profile_id'][:n].should == '9'
718
+ expect(results[:member].length).to eq 8
719
+ expect(results[:member].first['profile_id'][:n]).to eq '1'
720
+ expect(results[:member].last['profile_id'][:n]).to eq '9'
722
721
  end
723
722
 
724
723
  it 'v2: should handle local secondary indexes' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clientside_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perry Street Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '2.14'
145
+ version: '3.0'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '2.14'
152
+ version: '3.0'
153
153
  description: This code is meant to be used by developers who are attempting to build
154
154
  web applications on AWS but wish to run client-side testing and validation.
155
155
  email: