contacts_client 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  class ContactAttribute < LogicalModel
2
2
 
3
- AVAILABLE_TYPES = %w(telephone email identification address date_attribute custom_attribute)
3
+ AVAILABLE_TYPES = %w(telephone email identification address date_attribute custom_attribute social_network_id)
4
4
 
5
5
  attr_accessor :public, :primary
6
6
 
@@ -101,6 +101,10 @@ class PadmaContact < LogicalModel
101
101
  define_method(type.to_s.pluralize) { self.contact_attributes.reject {|attr| !attr.is_a? type.to_s.camelize.constantize}.sort_by {|x| [x.primary ? 0 : 1, x._id]} }
102
102
  end
103
103
 
104
+ def facebook_id
105
+ self.contact_attributes.select{|attr| attr.is_a?(SocialNetworkId) && attr.category == "facebook"}.first
106
+ end
107
+
104
108
  def mobiles
105
109
  self.contact_attributes.select{|attr| attr.is_a?(Telephone) && attr.category == "mobile"}
106
110
  end
@@ -0,0 +1,16 @@
1
+ class SocialNetworkId < ContactAttribute
2
+ attr_accessor :category, :value, :public, :primary
3
+
4
+ self.attribute_keys = [:_id, :_type, :public, :primary, :category, :value, :contact_id]
5
+
6
+ self.hydra = Contacts::HYDRA
7
+ self.resource_path = "/v0/contact_attributes"
8
+ self.use_api_key = true
9
+ self.api_key_name = "app_key"
10
+ self.api_key = Contacts::API_KEY
11
+ self.host = Contacts::HOST
12
+
13
+ def _type
14
+ self.class.name
15
+ end
16
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 9
9
- version: 0.0.9
8
+ - 10
9
+ version: 0.0.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dwayne Macgowan
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-01-30 00:00:00 -03:00
17
+ date: 2013-02-14 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -63,6 +63,7 @@ files:
63
63
  - app/models/email.rb
64
64
  - app/models/telephone.rb
65
65
  - app/models/custom_attribute.rb
66
+ - app/models/social_network_id.rb
66
67
  - app/models/padma_contact.rb
67
68
  - app/models/contacts_merge.rb
68
69
  - app/models/attachment.rb