Class: ShelbyArena::Client
- Inherits:
-
Object
- Object
- ShelbyArena::Client
- Includes:
- Batch, Contribution, Fund, Person
- Defined in:
- lib/shelby_arena/client.rb,
lib/shelby_arena/resources/fund.rb,
lib/shelby_arena/resources/batch.rb,
lib/shelby_arena/resources/person.rb,
lib/shelby_arena/resources/contribution.rb
Defined Under Namespace
Modules: Batch, Contribution, Fund, Person
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#api_session ⇒ Object
readonly
Returns the value of attribute api_session.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#ssl ⇒ Object
readonly
Returns the value of attribute ssl.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(url:, username:, password:, api_key:, api_secret:, logger: true, adapter: Faraday.default_adapter, ssl: nil) ⇒ Client
constructor
A new instance of Client.
- #json_post(path, options = {}) ⇒ Object
- #patch(path, options = {}) ⇒ Object
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Methods included from Contribution
#create_contribution, #find_contribution, #find_contributions_by_batch_id, #list_contributions
Methods included from Person
#create_person, #find_people_by_email, #find_people_by_name_and_email, #find_person, #list_people, #update_person
Methods included from Fund
Methods included from Batch
#create_batch, #delete_batch, #find_batch, #list_batches
Constructor Details
#initialize(url:, username:, password:, api_key:, api_secret:, logger: true, adapter: Faraday.default_adapter, ssl: nil) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shelby_arena/client.rb', line 16 def initialize(url:, username:, password:, api_key:, api_secret:, logger: true, adapter: Faraday.default_adapter, ssl: nil) if username.nil? && password.nil? raise ArgumentError, 'either username and password' end @url = "#{url}/api.svc/" @username = username @password = password @api_key = api_key @api_secret = api_secret @logger = logger @adapter = adapter @ssl = ssl @api_session = fetch_api_session end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def api_secret @api_secret end |
#api_session ⇒ Object (readonly)
Returns the value of attribute api_session.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def api_session @api_session end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def logger @logger end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def password @password end |
#ssl ⇒ Object (readonly)
Returns the value of attribute ssl.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def ssl @ssl end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
14 15 16 |
# File 'lib/shelby_arena/client.rb', line 14 def username @username end |
Instance Method Details
#delete(path, options = {}) ⇒ Object
32 33 34 |
# File 'lib/shelby_arena/client.rb', line 32 def delete(path, = {}) connection.delete(path, ).body end |
#get(path, options = {}) ⇒ Object
36 37 38 |
# File 'lib/shelby_arena/client.rb', line 36 def get(path, = {}) connection.get(path, ).body end |
#json_post(path, options = {}) ⇒ Object
48 49 50 |
# File 'lib/shelby_arena/client.rb', line 48 def json_post(path, = {}) connection(true).post(path, ).body end |
#patch(path, options = {}) ⇒ Object
40 41 42 |
# File 'lib/shelby_arena/client.rb', line 40 def patch(path, = {}) connection.patch(path, ).body end |
#post(path, options = {}) ⇒ Object
44 45 46 |
# File 'lib/shelby_arena/client.rb', line 44 def post(path, = {}) connection.post(path, ).body end |
#put(path, options = {}) ⇒ Object
52 53 54 |
# File 'lib/shelby_arena/client.rb', line 52 def put(path, = {}) connection.put(path, ).body end |