Module: Iupick
- Defined in:
- lib/iupick.rb,
lib/iupick/version.rb,
lib/iupick/shipment.rb,
lib/iupick/waypoint.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"1.0.1"
Class Attribute Summary collapse
-
.environment ⇒ Object
Returns the value of attribute environment.
-
.public_token ⇒ Object
Returns the value of attribute public_token.
-
.secret_token ⇒ Object
Returns the value of attribute secret_token.
Class Method Summary collapse
-
.create_address(city, line_one, postal_code, line_two = '', neighborhood = '') ⇒ Object
Initializes the address dictionary with the values to be passed.
-
.create_person(person_name, phone_number, email_address, title = '', company_name = '', phone_extension = '') ⇒ Object
Initializes the person_object with the values to be passed.
-
.empty_address ⇒ Object
Initializes the an empty address.
-
.generate_headers(auth) ⇒ Object
Returns the proper header either public or secret.
-
.get_base_url ⇒ Object
Gets the base url, to be used for the API service.
Class Attribute Details
.environment ⇒ Object
Returns the value of attribute environment.
16 17 18 |
# File 'lib/iupick.rb', line 16 def environment @environment end |
.public_token ⇒ Object
Returns the value of attribute public_token.
16 17 18 |
# File 'lib/iupick.rb', line 16 def public_token @public_token end |
.secret_token ⇒ Object
Returns the value of attribute secret_token.
16 17 18 |
# File 'lib/iupick.rb', line 16 def secret_token @secret_token end |
Class Method Details
.create_address(city, line_one, postal_code, line_two = '', neighborhood = '') ⇒ Object
Initializes the address dictionary with the values to be passed. This returns a dictionary for versatility.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 = '') ⇒ Object
Initializes the person_object with the values to be passed. This returns a dictionary for versatility.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# 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 ⇒ Object
Initializes the an empty address
39 40 41 42 43 44 45 46 47 |
# 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) ⇒ Object
Returns the proper header either public or secret.
83 84 85 86 87 88 89 90 91 92 |
# 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 ⇒ Object
Gets the base url, to be used for the API service.
72 73 74 75 76 77 78 79 80 |
# 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 |