Class: NationBuilder::Client
- Inherits:
-
Object
- Object
- NationBuilder::Client
- Defined in:
- lib/nation_builder/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#instrumentation ⇒ Object
Returns the value of attribute instrumentation.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#token ⇒ Object
Returns the value of attribute token.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(path, opts = {}) ⇒ Object
- #get(path, opts = {}) ⇒ Object
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
- #people ⇒ Object
- #post(path, opts = {}) ⇒ Object
- #put(path, opts = {}) ⇒ Object
- #tags ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nation_builder/client.rb', line 16 def initialize(args = {}) args.each do |key, value| self.send("#{key}=".intern, value) end if username.present? && password.present? self.client = setup_client_from_password elsif token.present? self.client = setup_client_from_token end end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def client @client end |
#client_id ⇒ Object
Returns the value of attribute client_id.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def client_secret @client_secret end |
#hostname ⇒ Object
Returns the value of attribute hostname.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def hostname @hostname end |
#instrumentation ⇒ Object
Returns the value of attribute instrumentation.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def instrumentation @instrumentation end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def token @token end |
#username ⇒ Object
Returns the value of attribute username.
14 15 16 |
# File 'lib/nation_builder/client.rb', line 14 def username @username end |
Instance Method Details
#delete(path, opts = {}) ⇒ Object
47 48 49 |
# File 'lib/nation_builder/client.rb', line 47 def delete(path, opts={}) instrumented_request(:delete, path, opts) end |
#get(path, opts = {}) ⇒ Object
35 36 37 |
# File 'lib/nation_builder/client.rb', line 35 def get(path, opts={}) instrumented_request(:get, path, opts) end |
#people ⇒ Object
27 28 29 |
# File 'lib/nation_builder/client.rb', line 27 def people NationBuilder::People.new(self) end |
#post(path, opts = {}) ⇒ Object
39 40 41 |
# File 'lib/nation_builder/client.rb', line 39 def post(path, opts={}) instrumented_request(:post, path, opts) end |
#put(path, opts = {}) ⇒ Object
43 44 45 |
# File 'lib/nation_builder/client.rb', line 43 def put(path, opts={}) instrumented_request(:put, path, opts) end |
#tags ⇒ Object
31 32 33 |
# File 'lib/nation_builder/client.rb', line 31 def NationBuilder::Tags.new(self) end |