class UplandMobileCommonsRest::Client
Attributes
company_key[RW]
password[RW]
username[RW]
Public Class Methods
new(options={}, &block)
click to toggle source
Calls superclass method
# File lib/upland_mobile_commons_rest/client.rb, line 7 def initialize(options={}, &block) self.username = options[:username] self.password = options[:password] self.company_key = options[:company_key] super(options, &block) end
Public Instance Methods
campaigns()
click to toggle source
Helper functions to let consumers do things like `client.campaigns.list`
# File lib/upland_mobile_commons_rest/client.rb, line 48 def campaigns @_campaigns ||= UplandMobileCommonsRest::Campaigns.new(client: self) end
default_options()
click to toggle source
# File lib/upland_mobile_commons_rest/client.rb, line 14 def default_options { host: 'secure.mcommons.com', prefix: '/api', user_agent: 'ruby: UplandMobileCommonsRest', content_type: 'application/x-www-form-urlencoded', additional_headers: { 'Accept' => 'application/xml' } } end
groups()
click to toggle source
# File lib/upland_mobile_commons_rest/client.rb, line 52 def groups @_groups ||= UplandMobileCommonsRest::Groups.new(client: self) end
profiles()
click to toggle source
# File lib/upland_mobile_commons_rest/client.rb, line 56 def profiles @_profiles ||= UplandMobileCommonsRest::Profiles.new(client: self) end
setup()
click to toggle source
# File lib/upland_mobile_commons_rest/client.rb, line 26 def setup connection.stack do |builder| builder.use Faraday::Request::Multipart builder.use Faraday::Request::UrlEncoded if connection.configuration.authenticated? builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password end builder.use UplandMobileCommonsRest::TypedErrorMiddleware builder.use Faraday::Response::Logger if ENV['DEBUG'] builder.use FaradayMiddleware::ParseXml builder.adapter connection.configuration.adapter end end