g_simple_api 0.1.0 → 0.1.1

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: 4dabc3e967dc70508ae7aee2d56fb491490d8f7a
4
- data.tar.gz: 3dcbcb5e17e0eaa7c34b869deef28530033ce32d
3
+ metadata.gz: 2b7d125c0b9596779526c7719855fa608ce3067d
4
+ data.tar.gz: c59717c4b174e277c22227975ea72bb7872cef17
5
5
  SHA512:
6
- metadata.gz: 584fec086285179e3b4e16d265c9670146b6213109ecd6713d5a0ad901960735d41141ee25eb3e13020419a63e49c9b3967fda1271bc7b66cc51ee7e1051320d
7
- data.tar.gz: ef4a5919aa1a57030c3e03f96d45f5807e1ba3825cd0797cc1b103fb64d445ca4ad2c5dd4f4d05a9b86d818ca33bb9d98768ae34056c59f9d5cd721d763a3fd0
6
+ metadata.gz: b5c6a6e2d78f143f3ece59e037b4b9abea0d51de4ac66054de4ffdc43d783686cd8303ba979ec9d8ec2a0defb46be67d736b13c261a7f7dd166bdf0da606e492
7
+ data.tar.gz: 3c968c4e8ad024746dad0a0042cdee0904f9b84f3ef08aefd4802261bc607cdc7ae1971fc118c8c0afac51f0d17c4173eaa45b20479b83faefc9518830611827
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - rbx-2
7
+ - ruby-head
8
+ - jruby
9
+ - jruby-head
10
+
11
+ notifications:
12
+ email:
13
+ recipients:
14
+ - goesmeira@gmail.com
15
+
16
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/g_simple_api.svg)](http://badge.fury.io/rb/g_simple_api)
2
+ [![Build Status](https://travis-ci.org/brunomeira/g_simple_api.svg)](https://travis-ci.org/brunomeira/g_simple_api)
2
3
 
3
4
  # GSimpleApi
4
5
 
5
- This gem wraps the calls executed by [googleapi-ruby-client](https://github.com/google/google-api-ruby-client)
6
+ This gem wraps the calls executed by [google-api-ruby-client](https://github.com/google/google-api-ruby-client)
6
7
  and makes it simple for you to be authorized and access the data provided by Google's apis.
7
8
 
8
9
  ## Getting Started
@@ -23,7 +24,7 @@ Or install it yourself as:
23
24
 
24
25
  To use the gem you will need to firstly create a project on [https://console.developers.google.com](https://console.developers.google.com), then allow access to the required apis and for last create a new Client ID.
25
26
 
26
- After completed the presetting process, you can go back to your app and work on the following steps:
27
+ After completed the pre-setting process, you can go back to your app and work on the following steps:
27
28
 
28
29
  #### First time use
29
30
  1. Create a *g_simple_api.rb* in /initializers
@@ -31,11 +32,11 @@ After completed the presetting process, you can go back to your app and work on
31
32
  GSimpleApi.setup do |config|
32
33
  config.name = "test" #The name of your application
33
34
  config.version = "1" #The current version of your application
34
- config.api = "plus" #The api that will be used.
35
- config.api_version = "v1" #If not specified, it will defaults to v1
35
+ config.api = "drive" #The api that will be used.
36
+ config.api_version = "v2" #If not specified, it will defaults to v1
36
37
  config.client_id = "XXXXXXXXXXXXXXXX" #Value provided in the Credentials Section.
37
38
  config.client_secret = "XXXXXXXXXXXXXX" #Value provided in the Credentials Section.
38
- config.scope = "plus.me" # The scope(s) required to use the api, it can be an Array.
39
+ config.scope = "drive" # The scope(s) required to use the api, it can be an Array.
39
40
  end
40
41
 
41
42
  2. You now have to send the user to Google's authorization page. Use:
@@ -52,7 +53,7 @@ For further use, You should store the values returned from this call.
52
53
 
53
54
  4. To make any call to the api, you have to invoke:
54
55
 
55
- manager.execute("method.name", {key1: "value", key2:"value2"})
56
+ manager.execute("method.name", {key1: "value", key2:"value2"}) # Example: manager.execute("files.list")
56
57
  where the first parameter is the action that will be executed and the second is any required or optional parameter.
57
58
 
58
59
  5. I hope you enjoy it.
@@ -61,22 +62,23 @@ where the first parameter is the action that will be executed and the second is
61
62
 
62
63
  Tokens may expire due a variety of different reasons. If you have stored the user's refresh token then you won't need to ask
63
64
  the users to go through all the acceptance process again (This is true for cases where the users didn't remove access to the app, you didn't change the scope of the app, or etc...). In order to do it so, you only need to call:
65
+
64
66
  manager = GSimpleApi.process
65
67
  manager.get_token("refresh_token", true) # The second parameter tells the function you are passing a refresh_token
66
68
 
67
69
  ## Further Reading
68
70
  If you are having trouble to understand the gem or want something more customizable, check the links below:
69
71
 
70
- 1. [googleapi-ruby-client](https://github.com/google/google-api-ruby-client) - GSimpleApi is based on this gem. If you need something more complex than get a token and access the api, you should check it out.
72
+ 1. [google-api-ruby-client](https://github.com/google/google-api-ruby-client) - GSimpleApi is based on this gem. If you need something more complex than get a token and access the api, you should check it out.
71
73
 
72
74
  2. [Google OAUTH process](https://developers.google.com/accounts/docs/OAuth2WebServer) If you need more background on how the authorization process works.
73
75
 
74
- 3. [APIs services](https://developers.google.com/apisexplorer) - Interesting resource, If you need to know which apis,services and scopes are available.
76
+ 3. [APIs services](https://developers.google.com/apis-explorer) - Interesting resource, If you need to know which apis,services and scopes are available.
75
77
 
76
78
  ## Contributing
77
79
 
78
80
  1. Fork it ( https://github.com/brunomeira/g_simple_api/fork )
79
81
  2. Create your feature branch (`git checkout b my-new-feature`)
80
82
  3. Commit your changes (`git commit am 'Add some feature'`)
81
- 4. Push to the branch (`git push origin mynew-feature`)
83
+ 4. Push to the branch (`git push origin my-new-feature`)
82
84
  5. Create a new Pull Request
data/g_simple_api.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "GSimpleApi makes it easy to access and receive data from google's apis "
13
13
  spec.homepage = "https://github.com/brunomeira/g_simple_api"
14
14
  spec.license = "Apache 2.0"
15
+ spec.required_ruby_version = '>= 1.9.3'
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0")
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -26,5 +27,4 @@ Gem::Specification.new do |spec|
26
27
  spec.add_development_dependency "guard"
27
28
  spec.add_development_dependency "guard-rspec"
28
29
  spec.add_development_dependency "pry"
29
- spec.add_development_dependency "byebug"
30
30
  end
@@ -14,6 +14,6 @@
14
14
  module GSimpleApi
15
15
  MAJOR = 0
16
16
  MINOR = 1
17
- PATCH = 0
17
+ PATCH = 1
18
18
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
19
19
  end
@@ -101,11 +101,11 @@ describe GSimpleApi::Manager do
101
101
  describe "#execute" do
102
102
  let(:method) { "activities.list" }
103
103
  before do
104
- mock_execute = mock("Test", :data => "result")
104
+ double_execute = double("Test", :data => "result")
105
105
  subject.stub(:split_method => ["activities", "list"])
106
106
  subject.stub(:chained_method_calls => "")
107
107
  subject.stub_chain(:settings, :discovered_api).and_return({})
108
- subject.stub_chain(:settings, :api_client, :execute).and_return(mock_execute)
108
+ subject.stub_chain(:settings, :api_client, :execute).and_return(double_execute)
109
109
  end
110
110
 
111
111
  it "calls #split_method once" do
@@ -126,4 +126,4 @@ describe GSimpleApi::Manager do
126
126
  end
127
127
  end
128
128
 
129
- end
129
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g_simple_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Meira
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: byebug
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
111
  description: 'GSimpleApi makes it easy to access and receive data from google''s apis '
126
112
  email:
127
113
  - goesmeira@gmail.com
@@ -131,6 +117,7 @@ extra_rdoc_files: []
131
117
  files:
132
118
  - ".gitignore"
133
119
  - ".rspec"
120
+ - ".travis.yml"
134
121
  - Gemfile
135
122
  - Guardfile
136
123
  - LICENSE.txt
@@ -159,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
146
  requirements:
160
147
  - - ">="
161
148
  - !ruby/object:Gem::Version
162
- version: '0'
149
+ version: 1.9.3
163
150
  required_rubygems_version: !ruby/object:Gem::Requirement
164
151
  requirements:
165
152
  - - ">="