module Bart
A Connection
adapter using HTTParty as the network transport
Constants
- VERSION
Public Class Methods
configuration()
click to toggle source
The current client configuration
# File lib/bart_api.rb, line 21 def configuration @configuration ||= Configuration.new end
configure(validate: true) { |configuration| ... }
click to toggle source
Allow users to set configuration options via a block. By default, the configuration will be validated after the block returns. This will raise an exception if any required configurations are not provided. This behavior can be skipped by passing `validate: false` as a parameter.
# File lib/bart_api.rb, line 29 def configure validate: true yield configuration configuration.validate! if validate configuration end
new()
click to toggle source
Alias for `Bart::Client.new`
# File lib/bart_api.rb, line 16 def new Client.new end
new(args={})
click to toggle source
Initialize a model instance with any given attributes assigned
# File lib/bart_api/models.rb, line 60 def initialize args={} assign(args) end
Public Instance Methods
==(o)
click to toggle source
Assume that two Model
objects are the same if their primary attributes have the same value
# File lib/bart_api/models.rb, line 79 def == o identifier == o.identifier end
assign(args={})
click to toggle source
Mass assign a group of attributes. Attribute names will be automatically be converted to snake_case for consistency.
# File lib/bart_api/models.rb, line 66 def assign args={} args.each do |_name, value| public_send("#{_name.underscore}=", value) if respond_to? "#{_name.underscore}=" end end
identifier()
click to toggle source
The value of the primary attribute on this model
# File lib/bart_api/models.rb, line 73 def identifier send(self.class.identifier) end