ffmike-rshoeboxed 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ require 'date'
2
+ require 'rexml/document'
3
+
4
+ module RShoeboxed
5
+ class BusinessCard
6
+ attr_accessor :id , :first_name,:last_name,:address,:address_2,
7
+ :city,:state,:zip,:country,:email,:website,
8
+ :company,:position,:work_phone,:cell_phone,:fax,
9
+ :front_img_url,:back_img_url,:created_date, :modified_date
10
+
11
+ def self.parse(xml)
12
+ document = REXML::Document.new(xml)
13
+ document.elements.collect("//BusinessCard") do |card_element|
14
+ card = BusinessCard.new
15
+ begin
16
+ card.id = card_element.attributes["id"]
17
+ card.first_name = card_element.attributes["firstName"]
18
+ card.last_name = card_element.attributes["lastName"]
19
+ card.address = card_element.attributes["address"]
20
+ card.address_2 = card_element.attributes["address2"]
21
+ card.city = card_element.attributes["city"]
22
+ card.state = card_element.attributes["state"]
23
+ card.zip = card_element.attributes["zip"]
24
+ card.country = card_element.attributes["country"]
25
+ card.email = card_element.attributes["email"]
26
+ card.website = card_element.attributes["website"]
27
+ card.company = card_element.attributes["company"]
28
+ card.position = card_element.attributes["position"]
29
+ card.work_phone = card_element.attributes["workPhone"]
30
+ card.cell_phone = card_element.attributes["cellPhone"]
31
+ card.fax = card_element.attributes["fax"]
32
+ card.front_img_url = card_element.attributes["frontImgUrl"]
33
+ card.back_img_url = card_element.attributes["backImgUrl"]
34
+ card.created_date = card_element.attributes["created_date"]
35
+ card.modified_date = card_element.attributes["modifiedDate"]
36
+ rescue => e
37
+ raise RShoeboxed::ParseError.new(e, card_element.to_s, "Error parsing card.")
38
+ end
39
+ card
40
+ end
41
+ end
42
+
43
+ def created_date=(date)
44
+ date = Date.parse(date) if date.is_a?(String)
45
+ @created_date = date
46
+ end
47
+
48
+ def modified_date=(date)
49
+ date = Date.parse(date) if date.is_a?(String)
50
+ @modified_date = date
51
+ end
52
+
53
+ def ==(card)
54
+ self.id == card.id
55
+ end
56
+ end
57
+ end
data/lib/rshoeboxed.rb CHANGED
@@ -10,5 +10,5 @@ require 'rshoeboxed/list_proxy'
10
10
  require 'rshoeboxed/parse_error'
11
11
 
12
12
  module RShoeboxed
13
- VERSION = '0.0.6'
13
+ VERSION = '0.0.7'
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffmike-rshoeboxed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Curren
@@ -98,6 +98,7 @@ files:
98
98
  - test/test_helper.rb
99
99
  - test/test_list_proxy.rb
100
100
  - test/test_receipt.rb
101
+ - lib/rshoeboxed/business_card.rb
101
102
  has_rdoc: true
102
103
  homepage: http://github.com/bcurren/rshoeboxed
103
104
  post_install_message: