Class: Agris::Client

Instance Method Summary collapse

Methods included from Api::Support

#build_response, #context_hash, #create_post_payload_xml, #extract_documents, #import, #post_input_hash

Methods included from Api::Name::FarmFields

#create_farm_field

Methods included from Api::Inventory::Orders

#create_order, #order, #orders, #orders_changed_since

Methods included from Api::Inventory::DeliveryTickets

#delivery_ticket, #delivery_tickets, #delivery_tickets_changed_since

Methods included from Api::Grain::Tickets

#create_ticket

Methods included from Api::Grain::SalesContracts

#sales_contract, #sales_contracts, #sales_contracts_changed_since

Methods included from Api::Grain::PurchaseContracts

#purchase_contract, #purchase_contracts, #purchase_contracts_changed_since

Methods included from Api::Grain::GrainModule

#create

Methods included from Api::Grain::CommodityCodes

#commodity_code, #commodity_codes

Methods included from Api::AccountsReceivables::Invoices

#create_invoice, #invoice, #invoices, #invoices_changed_since

Methods included from Api::AccountsPayables::Vouchers

#create_voucher

Constructor Details

#initialize(context = Agris.context, credentials = Agris.credentials, options = {}, dataset:) ⇒ Client

Initializes the client



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/agris/client.rb', line 19

def initialize(
  context = Agris.context,
  credentials = Agris.credentials,
  options = {},
  dataset:
)
  @context = context
  @logger = options[:logger] || Agris.logger
  @log_level = options[:log_level] || Agris.log_level
  @request_type = options[:request_type] || Agris.request_type
  @proxy_url = options.fetch(:proxy_url, Agris.proxy_url)
  @dataset = dataset || Agris.context.default_dataset
  @request = @request_type.new(
    @context.base_url, credentials, @logger, @log_level, @proxy_url
  )
end

Instance Method Details

#log(message) ⇒ Object



36
37
38
# File 'lib/agris/client.rb', line 36

def log(message)
  logger.info(message)
end