Class: OiApi::Client
- Inherits:
-
Object
- Object
- OiApi::Client
- Includes:
- HTTParty, Advertisers, AutoResponders, Balances, Cards, Charges, DataTransfers, Offers, Reports, Subscriptions, LookupTables
- Defined in:
- lib/oi_api/client.rb,
lib/oi_api/client/cards.rb,
lib/oi_api/client/offers.rb,
lib/oi_api/client/charges.rb,
lib/oi_api/client/reports.rb,
lib/oi_api/client/balances.rb,
lib/oi_api/client/advertisers.rb,
lib/oi_api/client/subscriptions.rb,
lib/oi_api/client/data_transfers.rb,
lib/oi_api/client/auto_responders.rb
Defined Under Namespace
Modules: Advertisers, AutoResponders, Balances, Cards, Charges, DataTransfers, Offers, Reports, Subscriptions
Constant Summary
Constants included from LookupTables
LookupTables::CATEGORIES, LookupTables::DATA_FIELDS
Instance Method Summary collapse
- #delete(url, options = {}) ⇒ Object
- #get(url, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(url, options = {}) ⇒ Object
- #put(url, options = {}) ⇒ Object
Methods included from Reports
Methods included from AutoResponders
#all_auto_responders, #auto_responder, #auto_responders, #create_auto_responder, #update_auto_responder
Methods included from DataTransfers
#create_data_transfer, #data_transfer, #data_transfers, #delete_data_transfer, #update_data_transfer
Methods included from Offers
#create_offer, #offer, #offers, #update_offer
Methods included from Balances
Methods included from Subscriptions
#create_subscription, #subscription, #subscriptions
Methods included from Charges
Methods included from Cards
#card, #create_card, #update_card
Methods included from Advertisers
#advertiser, #advertisers, #create_advertiser, #delete_advertiser, #update_advertiser
Methods included from LookupTables
category_ids, category_names, data_field_oi_name, data_fields
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/oi_api/client.rb', line 33 def initialize( = {}) # Use options passed in, but fall back to config module defaults = OiApi..merge() # Copy the merged values to this client and ignore those # not part of our configuration OiApi::Configuration::VALID_CONFIG_KEYS.each do |key| public_send("#{key}=", [key]) end if username.nil? || password.nil? raise NoCredentialsError, 'you must provide a username and password' end # set base_uri and format via HTTParty class methods self.class.base_uri(api_endpoint) self.class.format(format) end |
Instance Method Details
#delete(url, options = {}) ⇒ Object
64 65 66 |
# File 'lib/oi_api/client.rb', line 64 def delete(url, = {}) self.class.delete url, () end |
#get(url, options = {}) ⇒ Object
52 53 54 |
# File 'lib/oi_api/client.rb', line 52 def get(url, = {}) self.class.get url, () end |
#post(url, options = {}) ⇒ Object
56 57 58 |
# File 'lib/oi_api/client.rb', line 56 def post(url, = {}) self.class.post url, () end |
#put(url, options = {}) ⇒ Object
60 61 62 |
# File 'lib/oi_api/client.rb', line 60 def put(url, = {}) self.class.put url, () end |