module Iupick

Constants

VERSION

Attributes

environment[RW]
public_token[RW]
secret_token[RW]

Public Class Methods

create_address( city, line_one, postal_code, line_two='', neighborhood='' ) click to toggle source

Initializes the address dictionary with the values to be passed. This returns a dictionary for versatility.

# File lib/iupick.rb, line 21
def create_address(
  city,
  line_one,
  postal_code,
  line_two='',
  neighborhood=''
)

  return {
    'city': city,
    'line_one': line_one,
    'line_two': line_two,
    'neighborhood': neighborhood,
    'postal_code': postal_code
  }
end
create_person( person_name, phone_number, email_address, title = '', company_name = '', phone_extension = '' ) click to toggle source

Initializes the person_object with the values to be passed. This returns a dictionary for versatility.

# File lib/iupick.rb, line 52
def create_person(
  person_name,
  phone_number,
  email_address,
  title = '',
  company_name = '',
  phone_extension = ''
)

  return {
    'person_name': person_name,
    'phone_number': phone_number,
    'email_address': email_address,
    'title': title,
    'company_name': company_name,
    'phone_extension': phone_extension
  }
end
empty_address() click to toggle source

Initializes the an empty address

# File lib/iupick.rb, line 39
def empty_address()
  return create_address(
    city = 'Empty',
    line_one = 'Empty',
    postal_code = 'Empty',
    line_two = 'Empty',
    neighborhood = 'Empty'
  )
end
generate_headers(auth) click to toggle source

Returns the proper header either public or secret.

# File lib/iupick.rb, line 83
def generate_headers(auth)
  if auth == 'public'
    keyword = 'Token '
    token = public_token
  elsif auth == 'secret'
    keyword = 'Secret '
    token = secret_token
  end
  return {'Authorization': keyword + token}
end
get_base_url() click to toggle source

Gets the base url, to be used for the API service.

# File lib/iupick.rb, line 72
def get_base_url()
  if environment == 'development'
    return 'http://localhost:8000/api/'
  elsif environment == 'sandbox'
    return 'https://sandbox.iupick.com/api/'
  elsif environment == 'production'
    return 'https://iupick.com/api/'
  end
end