Permalink
Browse files

Add BusinessCard#envelope_code and bump to 0.5.3

  • Loading branch information...
1 parent 47acfbf commit 603f386dfd0d63aab0e86d1d21fa3e36440e69c8 @ffmike committed Mar 22, 2012
View
@@ -1,5 +1,10 @@
# Version History
+0.5.3
+March 22, 2012
+-----
+Added BusinessCard#envelope_code attribute.
+
0.5.2
December 11, 2011
-----
@@ -2,6 +2,6 @@ module Shoehorn
class BusinessCard
attr_accessor :id, :first_name, :last_name, :create_date, :address, :address2, :city, :state, :zip,
:country, :email, :website, :company, :position, :work_phone, :cell_phone, :fax, :front_img_url,
- :back_img_url, :note
+ :back_img_url, :note, :envelope_code
end
end
@@ -35,6 +35,7 @@ def self.parse(xml)
business_card.front_img_url = business_card_element.attributes["frontImgUrl"]
business_card.back_img_url = business_card_element.attributes["backImgUrl"]
business_card.note = business_card_element.attributes["note"]
+ business_card.envelope_code = business_card_element.attributes["envelopeCode"]
rescue => e
raise Shoehorn::ParseError.new(e, receipt_element.to_s, "Error parsing receipt.")
end
@@ -115,7 +116,7 @@ def notify_preference
end
# Turn auto-share mode on or off
- def notify_preference=(value)
+ def notify_preference=(value)
if value
translated_value = "1"
else
@@ -133,7 +134,7 @@ def notify_preference=(value)
# TODO: Retrieve the new value to make sure it worked?
value
end
-
+
def get_viral_business_card_email_text
xml = Builder::XmlMarkup.new
xml.instruct!
@@ -145,7 +146,7 @@ def get_viral_business_card_email_text
document = REXML::Document.new(response)
document.elements["GetViralBusinessCardEmailTextCallResponse"].elements["ViralEmailText"].text
end
-
+
# Get user's contact information that is sent out with business cards
def auto_share_contact_details
xml = Builder::XmlMarkup.new
@@ -161,13 +162,13 @@ def auto_share_contact_details
details[:first_name] = details_element.elements["FirstName"].text
details[:last_name] = details_element.elements["LastName"].text
details[:email] = details_element.elements["Email"].text
- details[:additional_contact_info] = details_element.elements["AdditionalContactInfo"].text
+ details[:additional_contact_info] = details_element.elements["AdditionalContactInfo"].text
details
end
- # Set user's contact information that is sent out with business cards
+ # Set user's contact information that is sent out with business cards
# value should be a hash {:first_name => "John", :last_name => "Doe", :email => "John.Doe@example.com", :additional_contact_info => "Only email on weekdays"}
- def auto_share_contact_details=(value)
+ def auto_share_contact_details=(value)
first_name = value[:first_name] || ''
last_name = value[:last_name] || ''
email = value[:email] || ''
@@ -184,7 +185,7 @@ def auto_share_contact_details=(value)
end
end
response = connection.post_xml(xml)
- # TODO: Retrieve the new value to make sure it worked?
+ # TODO: Retrieve the new value to make sure it worked?
# TODO: This can throw some specific efforts; see http://developer.shoeboxed.com/business-cards
value
end
View
@@ -1,3 +1,3 @@
module Shoehorn
- VERSION = "0.5.2"
+ VERSION = "0.5.3"
end
@@ -42,6 +42,7 @@ class BusinessCardsTest < ShoehornTest
assert_equal "https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&code=eb43ab329ef9902ps27bf2c1e4a93c51", business_cards[0].front_img_url
assert_equal "https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&back=y&code=eb43ab309ol99fc9727bf2c1e4a93c51", business_cards[0].back_img_url
assert_equal "met at downtown Durham networking event", business_cards[0].note
+ assert_nil business_cards[0].envelope_code
end
should "retrieve the total number of available business cards" do
@@ -76,6 +77,7 @@ class BusinessCardsTest < ShoehornTest
assert_equal "https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&code=eb43ab329ef9902ps27bf2c1e4a93c51", business_card.front_img_url
assert_equal "https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&back=y&code=eb43ab309ol99fc9727bf2c1e4a93c51", business_card.back_img_url
assert_equal "met at downtown Durham networking event", business_card.note
+ assert_equal "A1", business_card.envelope_code
end
# TODO: Check what Shoeboxed returns if ID doesn't match
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<GetBusinessCardInfoCallResponse>
- <BusinessCard id="331378049" firstName="Richard" lastName="Davies" createDate="2/5/2009" address="" address2="" city="RTP" state="NC" zip="27713" country="USA" email="Richard@Samplecompany.com" website="" company="Plaza Bridge" position="Managing Partner" workPhone="919 555-0557" cellPhone="" fax="" frontImgUrl="https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&code=eb43ab329ef9902ps27bf2c1e4a93c51" backImgUrl="https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&back=y&code=eb43ab309ol99fc9727bf2c1e4a93c51" note="met at downtown Durham networking event"/>
+ <BusinessCard id="331378049" firstName="Richard" lastName="Davies" createDate="2/5/2009" address="" address2="" city="RTP" state="NC" zip="27713" country="USA" email="Richard@Samplecompany.com" website="" company="Plaza Bridge" position="Managing Partner" workPhone="919 555-0557" cellPhone="" fax="" frontImgUrl="https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&code=eb43ab329ef9902ps27bf2c1e4a93c51" backImgUrl="https://www.shoeboxed.com/business-card.jpeg?bcid=331378049&back=y&code=eb43ab309ol99fc9727bf2c1e4a93c51" note="met at downtown Durham networking event" envelopeCode="A1"/>
</GetBusinessCardInfoCallResponse>

0 comments on commit 603f386

Please sign in to comment.