Class: Borneo::Client
- Inherits:
-
Object
- Object
- Borneo::Client
- Defined in:
- lib/borneo/client.rb
Constant Summary collapse
- @@should_mock_requests =
false
Instance Attribute Summary collapse
-
#application_name ⇒ Object
readonly
Returns the value of attribute application_name.
-
#application_version ⇒ Object
readonly
Returns the value of attribute application_version.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#redirect_url ⇒ Object
readonly
Returns the value of attribute redirect_url.
Class Method Summary collapse
- .disable_mocking! ⇒ Object
- .enable_mocking! ⇒ Object
- .reset_mocks! ⇒ Object
- .stub_service(service_name, service_version) ⇒ Object
Instance Method Summary collapse
- #for(access_token, refresh_token) ⇒ Object
- #google_client ⇒ Object
-
#initialize(client_id, client_secret, redirect_url, application_name = "Borneo Application", application_version = "0.0.1") ⇒ Client
constructor
A new instance of Client.
- #mocking_requests? ⇒ Boolean
Constructor Details
#initialize(client_id, client_secret, redirect_url, application_name = "Borneo Application", application_version = "0.0.1") ⇒ Client
Returns a new instance of Client.
26 27 28 29 30 31 32 33 |
# File 'lib/borneo/client.rb', line 26 def initialize(client_id, client_secret, redirect_url, application_name = "Borneo Application", application_version = "0.0.1") @client_id = client_id @client_secret = client_secret @redirect_url = redirect_url @google_client = nil @application_name = application_name @application_version = application_version end |
Instance Attribute Details
#application_name ⇒ Object (readonly)
Returns the value of attribute application_name.
7 8 9 |
# File 'lib/borneo/client.rb', line 7 def application_name @application_name end |
#application_version ⇒ Object (readonly)
Returns the value of attribute application_version.
7 8 9 |
# File 'lib/borneo/client.rb', line 7 def application_version @application_version end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
7 8 9 |
# File 'lib/borneo/client.rb', line 7 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
7 8 9 |
# File 'lib/borneo/client.rb', line 7 def client_secret @client_secret end |
#redirect_url ⇒ Object (readonly)
Returns the value of attribute redirect_url.
7 8 9 |
# File 'lib/borneo/client.rb', line 7 def redirect_url @redirect_url end |
Class Method Details
.disable_mocking! ⇒ Object
14 15 16 |
# File 'lib/borneo/client.rb', line 14 def self.disable_mocking! @@should_mock_requests = false end |
.enable_mocking! ⇒ Object
9 10 11 12 |
# File 'lib/borneo/client.rb', line 9 def self.enable_mocking! @@should_mock_requests = true @@service_stubs = {} end |
.reset_mocks! ⇒ Object
18 19 20 |
# File 'lib/borneo/client.rb', line 18 def self.reset_mocks! @@service_stubs = {} end |
Instance Method Details
#for(access_token, refresh_token) ⇒ Object
35 36 37 38 |
# File 'lib/borneo/client.rb', line 35 def for(access_token, refresh_token) google_client..clear_credentials! Borneo::AuthorizedProxy.new(self,access_token, refresh_token) end |
#google_client ⇒ Object
40 41 42 |
# File 'lib/borneo/client.rb', line 40 def google_client @google_client ||= Google::APIClient.new(:application_name => @application_name, :application_version => @application_version) end |
#mocking_requests? ⇒ Boolean
44 45 46 |
# File 'lib/borneo/client.rb', line 44 def mocking_requests? !!@@should_mock_requests end |