Skip to content

Commit

Permalink
Updated to replace httpadapter with faraday.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Aman committed Jan 27, 2012
1 parent 0bc3d49 commit 06cdb76
Show file tree
Hide file tree
Showing 19 changed files with 340 additions and 626 deletions.
45 changes: 26 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
# 0.4.0

* Replaced httpadapter gem dependency with faraday
* Replaced json gem dependency with multi_json
* Fixed /dev/null issues on Windows
* Repeated parameters now work

# 0.3.0

* updated to use v1 of the discovery API
* updated to use httpadapter 1.0.0
* added OAuth 2 support to the command line tool
* renamed some switches in the command line tool
* added additional configuration capabilities
* fixed a few deprecation warnings from dependencies
* added gemspec to source control
* Updated to use v1 of the discovery API
* Updated to use httpadapter 1.0.0
* Added OAuth 2 support to the command line tool
* Renamed some switches in the command line tool
* Added additional configuration capabilities
* Fixed a few deprecation warnings from dependencies
* Added gemspec to source control

# 0.2.0

* updated to use v1 of the discovery API
* updated to use httpadapter 1.0.0
* added OAuth 2 support to the command line tool
* renamed some switches in the command line tool
* added additional configuration capabilities
* Updated to use v1 of the discovery API
* Updated to use httpadapter 1.0.0
* Added OAuth 2 support to the command line tool
* Renamed some switches in the command line tool
* Added additional configuration capabilities

# 0.1.3

* added support for manual overrides of the discovery URI
* added support for manual overrides of the API base
* added support for xoauth_requestor_id
* Added support for manual overrides of the discovery URI
* Added support for manual overrides of the API base
* Added support for xoauth_requestor_id

# 0.1.2

* added support for two-legged OAuth
* moved some development dependencies into runtime
* Added support for two-legged OAuth
* Moved some development dependencies into runtime

# 0.1.1

* substantial improvements to the command line interface
* Substantial improvements to the command line interface

# 0.1.0

* initial release
* Initial release
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ APIs.
client.authorization.fetch_token_credential!(:verifier => '12345')

# Discover available methods
method_names = client.discovered_api('buzz').to_h.keys
method_names = client.discovered_api('plus').to_h.keys

# Make an API call
response = client.execute(
'chili.activities.list',
{'scope' => '@self', 'userId' => '@me', 'alt' => 'json'}
result = client.execute(
'plus.activities.list',
{'collection' => 'public', 'userId' => 'me'}
)
status, headers, body = response

# Install

Expand Down
15 changes: 10 additions & 5 deletions bin/google-api
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ OAUTH_SERVER_PORT = 12736

require 'rubygems'
require 'optparse'
require 'httpadapter'

gem 'faraday', '~> 0.7.0'
require 'faraday'
require 'faraday/utils'

require 'webrick'
require 'google/api_client/version'
require 'google/api_client'
Expand Down Expand Up @@ -183,6 +187,7 @@ HTML
end

def client
gem 'signet', '~> 0.3.0'
require 'signet/oauth_1/client'
require 'yaml'
require 'irb'
Expand Down Expand Up @@ -276,6 +281,7 @@ HTML
]

def oauth_1_login
gem 'signet', '~> 0.3.0'
require 'signet/oauth_1/client'
require 'launchy'
require 'yaml'
Expand Down Expand Up @@ -343,6 +349,7 @@ HTML
end

def oauth_2_login
gem 'signet', '~> 0.3.0'
require 'signet/oauth_2/client'
require 'launchy'
require 'yaml'
Expand Down Expand Up @@ -467,8 +474,7 @@ HTML
request = [method, uri.to_str, headers, [request_body]]
request = client.generate_authenticated_request(:request => request)
response = client.transmit(request)
status, headers, body = response
puts body
puts response.body
exit(0)
else
# Make request with URI generated from template and parameters
Expand Down Expand Up @@ -502,8 +508,7 @@ HTML
:merged_body => request_body,
:headers => headers
)
status, headers, body = result.response
puts body
puts result.response.body
exit(0)
rescue ArgumentError => e
puts e.message
Expand Down
46 changes: 25 additions & 21 deletions google-api-client.gemspec
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = "google-api-client"
s.version = "0.3.0"
s.name = %q{google-api-client}
s.version = "0.4.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bob Aman"]
s.date = "2011-11-22"
s.description = "The Google API Ruby Client makes it trivial to discover and access supported\nAPIs.\n"
s.email = "bobaman@google.com"
s.date = %q{2012-01-27}
s.default_executable = %q{google-api}
s.description = %q{The Google API Ruby Client makes it trivial to discover and access supported
APIs.
}
s.email = %q{bobaman@google.com}
s.executables = ["google-api"]
s.extra_rdoc_files = ["README.md"]
s.files = ["lib/google", "lib/google/api_client", "lib/google/api_client/discovery", "lib/google/api_client/discovery/api.rb", "lib/google/api_client/discovery/method.rb", "lib/google/api_client/discovery/resource.rb", "lib/google/api_client/discovery/schema.rb", "lib/google/api_client/discovery.rb", "lib/google/api_client/environment.rb", "lib/google/api_client/errors.rb", "lib/google/api_client/parser.rb", "lib/google/api_client/parsers", "lib/google/api_client/parsers/json", "lib/google/api_client/parsers/json/error_parser.rb", "lib/google/api_client/parsers/json/pagination.rb", "lib/google/api_client/parsers/json_parser.rb", "lib/google/api_client/reference.rb", "lib/google/api_client/result.rb", "lib/google/api_client/version.rb", "lib/google/api_client.rb", "lib/google/inflection.rb", "spec/google", "spec/google/api_client", "spec/google/api_client/discovery_spec.rb", "spec/google/api_client/parsers", "spec/google/api_client/parsers/json_parser_spec.rb", "spec/google/api_client_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/rdoc.rake", "tasks/spec.rake", "tasks/wiki.rake", "tasks/yard.rake", "CHANGELOG.md", "LICENSE", "Rakefile", "README.md", "bin/google-api"]
s.homepage = "http://code.google.com/p/google-api-ruby-client/"
s.files = ["lib/google", "lib/google/api_client", "lib/google/api_client/discovery", "lib/google/api_client/discovery/api.rb", "lib/google/api_client/discovery/method.rb", "lib/google/api_client/discovery/resource.rb", "lib/google/api_client/discovery/schema.rb", "lib/google/api_client/discovery.rb", "lib/google/api_client/environment.rb", "lib/google/api_client/errors.rb", "lib/google/api_client/reference.rb", "lib/google/api_client/result.rb", "lib/google/api_client/version.rb", "lib/google/api_client.rb", "lib/google/inflection.rb", "spec/google", "spec/google/api_client", "spec/google/api_client/discovery_spec.rb", "spec/google/api_client_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/rdoc.rake", "tasks/spec.rake", "tasks/wiki.rake", "tasks/yard.rake", "CHANGELOG.md", "LICENSE", "Rakefile", "README.md", "bin/google-api"]
s.homepage = %q{http://code.google.com/p/google-api-ruby-client/}
s.rdoc_options = ["--main", "README.md"]
s.require_paths = ["lib"]
s.rubygems_version = "1.8.11"
s.summary = "Package Summary"
s.rubygems_version = %q{1.3.7}
s.summary = %q{Package Summary}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<signet>, ["~> 0.2.2"])
s.add_runtime_dependency(%q<addressable>, ["~> 2.2.2"])
s.add_runtime_dependency(%q<httpadapter>, ["~> 1.0.1"])
s.add_runtime_dependency(%q<signet>, ["~> 0.3.0"])
s.add_runtime_dependency(%q<addressable>, ["~> 2.2.3"])
s.add_runtime_dependency(%q<autoparse>, ["~> 0.2.0"])
s.add_runtime_dependency(%q<json>, [">= 1.4.6"])
s.add_runtime_dependency(%q<faraday>, ["~> 0.7.0"])
s.add_runtime_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_runtime_dependency(%q<extlib>, [">= 0.9.15"])
s.add_runtime_dependency(%q<launchy>, [">= 2.0.0"])
s.add_development_dependency(%q<sinatra>, [">= 1.2.0"])
Expand All @@ -35,11 +39,11 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<rcov>, [">= 0.9.9"])
s.add_development_dependency(%q<diff-lcs>, [">= 1.1.2"])
else
s.add_dependency(%q<signet>, ["~> 0.2.2"])
s.add_dependency(%q<addressable>, ["~> 2.2.2"])
s.add_dependency(%q<httpadapter>, ["~> 1.0.1"])
s.add_dependency(%q<signet>, ["~> 0.3.0"])
s.add_dependency(%q<addressable>, ["~> 2.2.3"])
s.add_dependency(%q<autoparse>, ["~> 0.2.0"])
s.add_dependency(%q<json>, [">= 1.4.6"])
s.add_dependency(%q<faraday>, ["~> 0.7.0"])
s.add_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_dependency(%q<extlib>, [">= 0.9.15"])
s.add_dependency(%q<launchy>, [">= 2.0.0"])
s.add_dependency(%q<sinatra>, [">= 1.2.0"])
Expand All @@ -49,11 +53,11 @@ Gem::Specification.new do |s|
s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
end
else
s.add_dependency(%q<signet>, ["~> 0.2.2"])
s.add_dependency(%q<addressable>, ["~> 2.2.2"])
s.add_dependency(%q<httpadapter>, ["~> 1.0.1"])
s.add_dependency(%q<signet>, ["~> 0.3.0"])
s.add_dependency(%q<addressable>, ["~> 2.2.3"])
s.add_dependency(%q<autoparse>, ["~> 0.2.0"])
s.add_dependency(%q<json>, [">= 1.4.6"])
s.add_dependency(%q<faraday>, ["~> 0.7.0"])
s.add_dependency(%q<multi_json>, [">= 1.0.0"])
s.add_dependency(%q<extlib>, [">= 0.9.15"])
s.add_dependency(%q<launchy>, [">= 2.0.0"])
s.add_dependency(%q<sinatra>, [">= 1.2.0"])
Expand Down
Loading

0 comments on commit 06cdb76

Please sign in to comment.