Class: Crowdskout::Api
- Inherits:
-
Object
- Object
- Crowdskout::Api
- Defined in:
- lib/crowdskout/api.rb
Instance Method Summary collapse
- #create_attribute(name, type, options = nil) ⇒ Object
- #create_profile(profile) ⇒ Object
- #create_profiles_bulk(profiles) ⇒ Object
- #delete_attribute(attribute_id) ⇒ Object
- #get_attribute(attribute_id, params = {}) ⇒ Object
-
#get_attributes(params = {}) ⇒ Object
Attribute Service Methods.
-
#get_options_for_a_field(field_name, params = {}) ⇒ Object
Fields Service Methods.
-
#get_profile(profile_id, collections) ⇒ Object
Profile Service Methods.
-
#initialize(api_key = nil, access_token = nil) ⇒ Object
constructor
Class constructor.
-
#tracking_code ⇒ Object
Quartermaster Service Methods.
- #update_attribute(attribute_id, params = {}) ⇒ Object
- #update_profile(profile) ⇒ Object
- #update_profiles_bulk(profiles) ⇒ Object
Constructor Details
#initialize(api_key = nil, access_token = nil) ⇒ Object
Class constructor
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/crowdskout/api.rb', line 13 def initialize(api_key = nil, access_token = nil) Services::BaseService.api_key = api_key || Util::Config.get('auth.api_key') Services::BaseService.access_token = access_token if Services::BaseService.api_key.nil? || Services::BaseService.api_key == '' raise ArgumentError.new(Util::Config.get('errors.api_key_missing')) end if Services::BaseService.access_token.nil? || Services::BaseService.access_token == '' raise ArgumentError.new(Util::Config.get('errors.access_token_missing')) end end |
Instance Method Details
#create_attribute(name, type, options = nil) ⇒ Object
53 54 55 |
# File 'lib/crowdskout/api.rb', line 53 def create_attribute(name, type, = nil) Services::AttributeService.create_attribute(name, type, ) end |
#create_profile(profile) ⇒ Object
28 29 30 |
# File 'lib/crowdskout/api.rb', line 28 def create_profile(profile) Services::ProfileService.create_profile(profile) end |
#create_profiles_bulk(profiles) ⇒ Object
31 32 33 |
# File 'lib/crowdskout/api.rb', line 31 def create_profiles_bulk(profiles) Services::ProfileService.create_profiles_bulk(profiles) end |
#delete_attribute(attribute_id) ⇒ Object
59 60 61 |
# File 'lib/crowdskout/api.rb', line 59 def delete_attribute(attribute_id) Services::AttributeService.delete_attribute(attribute_id) end |
#get_attribute(attribute_id, params = {}) ⇒ Object
50 51 52 |
# File 'lib/crowdskout/api.rb', line 50 def get_attribute(attribute_id, params = {}) Services::AttributeService.get_attribute(attribute_id) end |
#get_attributes(params = {}) ⇒ Object
Attribute Service Methods
47 48 49 |
# File 'lib/crowdskout/api.rb', line 47 def get_attributes(params = {}) Services::AttributeService.get_attributes(params) end |
#get_options_for_a_field(field_name, params = {}) ⇒ Object
Fields Service Methods
42 43 44 |
# File 'lib/crowdskout/api.rb', line 42 def (field_name, params = {}) Services::FieldService.(field_name, params) end |
#get_profile(profile_id, collections) ⇒ Object
Profile Service Methods
25 26 27 |
# File 'lib/crowdskout/api.rb', line 25 def get_profile(profile_id, collections) Services::ProfileService.get_profile(profile_id, collections) end |
#tracking_code ⇒ Object
Quartermaster Service Methods
64 65 66 |
# File 'lib/crowdskout/api.rb', line 64 def tracking_code Services::QuartermasterService.tracking_code end |
#update_attribute(attribute_id, params = {}) ⇒ Object
56 57 58 |
# File 'lib/crowdskout/api.rb', line 56 def update_attribute(attribute_id, params = {}) Services::AttributeService.update_attribute(attribute_id, params) end |
#update_profile(profile) ⇒ Object
34 35 36 |
# File 'lib/crowdskout/api.rb', line 34 def update_profile(profile) Services::ProfileService.update_profile(profile) end |
#update_profiles_bulk(profiles) ⇒ Object
37 38 39 |
# File 'lib/crowdskout/api.rb', line 37 def update_profiles_bulk(profiles) Services::ProfileService.update_profiles_bulk(profiles) end |