contacts_client 0.0.11 → 0.0.12
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.
- data/app/models/tag.rb +9 -29
- metadata +5 -5
data/app/models/tag.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
class Tag < LogicalModel
|
2
2
|
attr_accessor :name
|
3
3
|
|
4
|
-
|
4
|
+
attribute :_id
|
5
|
+
attribute :name
|
6
|
+
attribute :contact_ids
|
7
|
+
attribute :account_name
|
8
|
+
|
9
|
+
set_resource_url Contacts::HOST, "/v0/tags"
|
10
|
+
|
11
|
+
set_api_key(:app_key,Contacts::API_KEY)
|
5
12
|
|
6
13
|
self.hydra = Contacts::HYDRA
|
7
|
-
self.resource_path = "/v0/tags"
|
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
14
|
|
13
15
|
validates :name, :presence => true
|
14
16
|
|
@@ -31,28 +33,6 @@ class Tag < LogicalModel
|
|
31
33
|
|
32
34
|
# Returns all the tags associated with a given account
|
33
35
|
def self.account_tags(account_name)
|
34
|
-
|
35
|
-
params = self.merge_key(params)
|
36
|
-
|
37
|
-
|
38
|
-
response = nil
|
39
|
-
Timeout::timeout(self.timeout/1000) do
|
40
|
-
response = Typhoeus::Request.get( "#{url_protocol_prefix}#{self.host}/v0/accounts/#{account_name}/tags", :params => params, :timeout => self.timeout )
|
41
|
-
end
|
42
|
-
|
43
|
-
if response.code == 200
|
44
|
-
log_ok(response)
|
45
|
-
result_set = self.from_json(response.body)
|
46
|
-
return result_set[:collection]
|
47
|
-
elsif response.code == 400
|
48
|
-
log_failed(response)
|
49
|
-
return false
|
50
|
-
else
|
51
|
-
log_failed(response)
|
52
|
-
return nil
|
53
|
-
end
|
54
|
-
rescue Timeout::Error
|
55
|
-
self.logger.warn "timeout"
|
56
|
-
return nil
|
36
|
+
paginate(per_page: 999, account_name: account_name)
|
57
37
|
end
|
58
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contacts_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
37
|
+
version: 0.5.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: 0.5.0
|
46
46
|
description: This is client library for padma-Contacts-ws
|
47
47
|
email:
|
48
48
|
- dwaynemac@gmail.com
|
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
segments:
|
85
85
|
- 0
|
86
|
-
hash: -
|
86
|
+
hash: -863575843
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
88
|
none: false
|
89
89
|
requirements:
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
segments:
|
94
94
|
- 0
|
95
|
-
hash: -
|
95
|
+
hash: -863575843
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
98
|
rubygems_version: 1.8.25
|