fog-google 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92c9efd9ddab995f14a3f4eeb4ffca1ba7ee6ccc
4
- data.tar.gz: 28ea5908d53b53f5b893c1d235503083989e6aa3
3
+ metadata.gz: 60125d11954dd919a8685781db294ef96edcc0fc
4
+ data.tar.gz: 7df579f5e21c306d18112e12bad9e038b6a92b75
5
5
  SHA512:
6
- metadata.gz: 6ddc1cd98ae4127f6c8ea549bbceee964c6cc15cb8e8f30def296bb7764a4f42455fc9c97f4fe1876e901644b9ba9227843566fb68f9cb38847d5e816c72fc55
7
- data.tar.gz: 5c9ef2418309ff8ff900717fc2ea9650429e465a051aadec83b7809b0a6aebc1ff296bad96c788b0cba1679999f7de4ca557ccc9942ac95f1896e27569eb92fb
6
+ metadata.gz: 365da53d78669fe0d8c9d50fe81b10a9cf759152ea11b282ec452e15d7a292360b35f36b187df9a5dc0e47255886a8c8a954d521ad05991371c9189e711d165d
7
+ data.tar.gz: a2e8e2812ee8f084805858eee655d89ba10400e3c8585e3066dfbce7b4fc8ea1286c28cd8ac65095ebf4df86ff32dd9564bb5924fceb1a00536b0d78e99b1176
data/.travis.yml CHANGED
@@ -3,10 +3,10 @@ sudo: false
3
3
  matrix:
4
4
  fast_finish: true
5
5
  include:
6
- - rvm: 2.0
7
6
  - rvm: 2.1
8
7
  - rvm: 2.2
9
8
  - rvm: 2.3.0
9
+ - rvm: 2.3.1
10
10
  - rvm: jruby-head
11
11
  allow_failures:
12
12
  - rvm: jruby-head
data/README.md CHANGED
@@ -60,7 +60,7 @@ Or install it yourself as:
60
60
  $ gem install fog-google
61
61
  ```
62
62
 
63
- ### Setup
63
+ ## Setup
64
64
 
65
65
  #### Credentials
66
66
 
@@ -83,10 +83,23 @@ my_credentials:
83
83
  google_storage_secret_access_key: XXXX+XXX/XXXXXXXX+XXXXXXXXXXXXXXXXXXXXX
84
84
  ```
85
85
 
86
-
87
86
  #### SSH-ing into instances
88
87
 
89
- If you want to be able to bootstrap SSH-able instances, (using `servers.bootstrap`,) be sure you have a key in `~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`.
88
+ If you want to be able to bootstrap SSH-able instances, (using `servers.bootstrap`,) be sure you have a key in `~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`
89
+
90
+ ## Quickstart
91
+
92
+ Once you've specified your credentials, you should be good to go!
93
+ ```
94
+ λ bundle exec pry
95
+ [1] pry(main)> require 'fog/google'
96
+ => true
97
+ [2] pry(main)> connection = Fog::Compute::Google.new
98
+ [3] pry(main)> connection.servers
99
+ => [ <Fog::Compute::Google::Server
100
+ name="xxxxxxx",
101
+ kind="compute#instance",
102
+ ```
90
103
 
91
104
  ## Contributing
92
105
 
@@ -26,9 +26,8 @@ module Fog
26
26
  "topic" => (topic.is_a?(Topic) ? topic.name : topic.to_s)
27
27
  }
28
28
 
29
- if !push_config.nil? && push_config.key?("push_endpoint")
30
- body["pushConfig"] = push_config["push_endpoint"].clone
31
- body["pushConfig"]["attributes"] = push_config["attributes"] if push_config.key?("attributes")
29
+ unless push_config.empty?
30
+ body["pushConfig"] = push_config
32
31
  end
33
32
 
34
33
  body["ackDeadlineSeconds"] = ack_deadline_seconds unless ack_deadline_seconds.nil?
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Google
3
- VERSION = "0.4.1".freeze
3
+ VERSION = "0.4.2".freeze
4
4
  end
5
5
  end
@@ -40,6 +40,7 @@ module Fog
40
40
  request :get_object_url
41
41
  request :head_object
42
42
  request :list_buckets
43
+ request :list_objects
43
44
  request :put_bucket
44
45
  request :put_bucket_acl
45
46
  request :put_object
@@ -2,7 +2,7 @@ module Fog
2
2
  module Storage
3
3
  class GoogleJSON
4
4
  class File < Fog::Model
5
- identity :key, :aliases => "Key"
5
+ identity :key, :aliases => %w{Key name}
6
6
 
7
7
  attribute :acl
8
8
  attribute :predefined_acl
@@ -16,22 +16,8 @@ module Fog
16
16
 
17
17
  def all(options = {})
18
18
  requires :directory
19
- options = {
20
- "delimiter" => delimiter,
21
- "pageToken" => page_token,
22
- "maxResults" => max_results,
23
- "prefix" => prefix
24
- }.merge!(options)
25
- options = options.reject { |_key, value| value.nil? || value.to_s.empty? }
26
- merge_attributes(options)
27
- parent = directory.collection.get(
28
- directory.key,
29
- options
30
- )
31
- if parent
32
- merge_attributes(parent.files.attributes)
33
- load(parent.files.map(&:attributes))
34
- end
19
+
20
+ load(service.list_objects(directory.key, options)[:body]["items"])
35
21
  end
36
22
 
37
23
  alias_method :each_file_this_page, :each
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Storage
3
+ class GoogleJSON
4
+ class Real
5
+ # Lists objects in a bucket matching some criteria.
6
+ #
7
+ # @param bucket [String] name of bucket to list
8
+ # @param options [Hash] optional hash of options
9
+ # @option options [String] :delimiter Delimiter to collapse objects
10
+ # under to emulate a directory-like mode
11
+ # @option options [Integer] :max_results Maximum number of results to
12
+ # retrieve
13
+ # @option options [String] :page_token Token to select a particular page
14
+ # of results
15
+ # @option options [String] :prefix String that an object must begin with
16
+ # in order to be returned
17
+ # @option options ["full", "noAcl"] :projection Set of properties to
18
+ # return (defaults to "noAcl")
19
+ # @option options [Boolean] :versions If true, lists all versions of an
20
+ # object as distinct results (defaults to False)
21
+ def list_objects(bucket, options = {})
22
+ api_method = @storage_json.objects.list
23
+ parameters = {
24
+ "bucket" => bucket
25
+ }
26
+
27
+ # Optional parameters
28
+ {
29
+ :delimiter => "delimiter",
30
+ :max_results => "maxResults",
31
+ :page_token => "pageToken",
32
+ :prefix => "prefix",
33
+ :projection => "projection",
34
+ :versions => "versions"
35
+ }.each do |k, v|
36
+ parameters[v] = options[k] unless options[k].nil?
37
+ end
38
+
39
+ request(api_method, parameters)
40
+ end
41
+ end
42
+
43
+ class Mock
44
+ def list_objects(_bucket, _options = {})
45
+ Fog::Mock.not_implemented
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Welch
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-10-11 00:00:00.000000000 Z
14
+ date: 2016-10-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -563,6 +563,7 @@ files:
563
563
  - lib/fog/storage/google_json/requests/get_object_url.rb
564
564
  - lib/fog/storage/google_json/requests/head_object.rb
565
565
  - lib/fog/storage/google_json/requests/list_buckets.rb
566
+ - lib/fog/storage/google_json/requests/list_objects.rb
566
567
  - lib/fog/storage/google_json/requests/put_bucket.rb
567
568
  - lib/fog/storage/google_json/requests/put_bucket_acl.rb
568
569
  - lib/fog/storage/google_json/requests/put_object.rb
@@ -719,7 +720,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
719
720
  version: '0'
720
721
  requirements: []
721
722
  rubyforge_project:
722
- rubygems_version: 2.4.8
723
+ rubygems_version: 2.5.1
723
724
  signing_key:
724
725
  specification_version: 4
725
726
  summary: Module for the 'fog' gem to support Google.