class Crowdskout::Api

Attributes

access_token[RW]
api_key[RW]

Public Class Methods

new(api_key = nil, access_token = nil) click to toggle source

Class constructor @param [String] api_key - Crowdskout API Key @param [String] access_token - Crowdskout OAuth2 access token @return

# File lib/crowdskout/api.rb, line 15
def initialize(api_key = nil, access_token = nil)
  @api_key = api_key || Util::Config.get('auth.api_key')
  @access_token = access_token
  if @api_key.nil? || @api_key == ''
    raise ArgumentError.new(Util::Config.get('errors.api_key_missing'))
  end
  if @access_token.nil? || @access_token == ''
    raise ArgumentError.new(Util::Config.get('errors.access_token_missing'))
  end
end

Public Instance Methods

check_for_non_match(profile) click to toggle source
# File lib/crowdskout/api.rb, line 42
def check_for_non_match(profile)
  Services::ProfileService.new(@api_key, @access_token).check_for_non_match(profile)
end
create_attribute(name, type, options = nil) click to toggle source
# File lib/crowdskout/api.rb, line 58
def create_attribute(name, type, options = nil)
  Services::AttributeService.new(@api_key, @access_token).create_attribute(name, type, options)
end
create_profile(profile) click to toggle source
# File lib/crowdskout/api.rb, line 30
def create_profile(profile)
  Services::ProfileService.new(@api_key, @access_token).create_profile(profile)
end
create_profiles_bulk(profiles) click to toggle source
# File lib/crowdskout/api.rb, line 33
def create_profiles_bulk(profiles)
  Services::ProfileService.new(@api_key, @access_token).create_profiles_bulk(profiles)
end
delete_attribute(attribute_id) click to toggle source
# File lib/crowdskout/api.rb, line 64
def delete_attribute(attribute_id)
  Services::AttributeService.new(@api_key, @access_token).delete_attribute(attribute_id)
end
get_attribute(attribute_id, params = {}) click to toggle source
# File lib/crowdskout/api.rb, line 55
def get_attribute(attribute_id, params = {})
  Services::AttributeService.new(@api_key, @access_token).get_attribute(attribute_id)
end
get_attributes(params = {}) click to toggle source

Attribute Service Methods

# File lib/crowdskout/api.rb, line 52
def get_attributes(params = {})
  Services::AttributeService.new(@api_key, @access_token).get_attributes(params)
end
get_options_for_a_field(field_name, params = {}) click to toggle source

Fields Service Methods

# File lib/crowdskout/api.rb, line 47
def get_options_for_a_field(field_name, params = {})
  Services::FieldService.new(@api_key, @access_token).get_options_for_a_field(field_name, params)
end
get_profile(profile_id, collections) click to toggle source

Profile Service Methods

# File lib/crowdskout/api.rb, line 27
def get_profile(profile_id, collections)
  Services::ProfileService.new(@api_key, @access_token).get_profile(profile_id, collections)
end
tracking_code() click to toggle source

Quartermaster Service Methods

# File lib/crowdskout/api.rb, line 69
def tracking_code
  Services::QuartermasterService.new(@api_key, @access_token).tracking_code
end
update_attribute(attribute_id, params = {}) click to toggle source
# File lib/crowdskout/api.rb, line 61
def update_attribute(attribute_id, params = {})
  Services::AttributeService.new(@api_key, @access_token).update_attribute(attribute_id, params)
end
update_profile(profile) click to toggle source
# File lib/crowdskout/api.rb, line 36
def update_profile(profile)
  Services::ProfileService.new(@api_key, @access_token).update_profile(profile)
end
update_profiles_bulk(profiles) click to toggle source
# File lib/crowdskout/api.rb, line 39
def update_profiles_bulk(profiles)
  Services::ProfileService.new(@api_key, @access_token).update_profiles_bulk(profiles)
end