limdesk_api 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -9
- data/lib/limdesk_api/client.rb +42 -0
- data/lib/limdesk_api/limdesk_object.rb +7 -7
- data/lib/limdesk_api/ticket.rb +3 -3
- data/lib/limdesk_api/version.rb +1 -1
- data/lib/limdesk_api.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bde3e1c2acf2d3e2f7729b0a0a6ae9cbb0e2ed8
|
4
|
+
data.tar.gz: b62de19124f071329574232d15eb8c405fe22da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac18ac6ba9c3bd79a5a0df8623b865eaadaead371e2c13a287181238b50924f726e3eff1956c7fcced611c98dd74971fcca618419699818556046d0c1cbd32b5
|
7
|
+
data.tar.gz: b89694f0ea6877fc9c49f845ccd17739280e8ac719bc6adca25c8bce4a5af2c547dd15f89cf505c3ec96a52da1b3a4924e062a7cb35e7d81a81bd381ba64732b
|
data/README.md
CHANGED
@@ -18,9 +18,9 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
This gem will allow you to interact with Limdesk API. [Limdesk.com](http://limdesk.com) is a lightweight, multichannel customer support solution.
|
21
|
+
This gem will allow you to interact with Limdesk API. [Limdesk.com](http://limdesk.com) is a lightweight, multichannel customer support solution.
|
22
22
|
|
23
|
-
API is available to free and premium users. You can generate your APIKEY in Settings/Integration/API section.
|
23
|
+
API is available to free and premium users. You can generate your APIKEY in Settings/Integration/API section.
|
24
24
|
|
25
25
|
This gem wrappes Limdesk API into OpenStruct (RecursiveOpenStruct) objects. For more information about API check the [official docs](http://help.limdesk.com/en/category/458/API_documentation). Current API covers basic, most common actions. More advanced version is currenty under development.
|
26
26
|
|
@@ -56,7 +56,7 @@ ticket.client.name
|
|
56
56
|
ticket.answer content: 'this is a private comment', answer_type: :priv
|
57
57
|
ticket.answer content: 'dear customer, it is solved', answer_type: :pub
|
58
58
|
|
59
|
-
ticket.close content: 'its solved', type: :resolved
|
59
|
+
ticket.close content: 'its solved', type: :resolved
|
60
60
|
ticket.reopen
|
61
61
|
ticket.close content: 'spam', type: :rejected
|
62
62
|
|
@@ -64,13 +64,13 @@ ticket2 = LimdeskApi::Ticket.create :title => "problem",
|
|
64
64
|
:content => "clients probem",
|
65
65
|
:reported_by => :mail,
|
66
66
|
:client_id => -1
|
67
|
-
|
67
|
+
|
68
68
|
# reported_by can be :mail, :phone, :other, :chat
|
69
69
|
# client_id => -1 means "new anonymous clinet"
|
70
|
-
|
70
|
+
|
71
71
|
ticket2.title
|
72
72
|
"sample ticket 2"
|
73
|
-
|
73
|
+
|
74
74
|
```
|
75
75
|
|
76
76
|
#### Activities
|
@@ -80,7 +80,7 @@ ticket2.title
|
|
80
80
|
acts = LimdeskApi::Activity.all
|
81
81
|
|
82
82
|
act = LimdeskApi::Activity.create content: "client has logged into website",
|
83
|
-
client_id: 55
|
83
|
+
client_id: 55
|
84
84
|
```
|
85
85
|
|
86
86
|
#### Clients
|
@@ -93,17 +93,26 @@ cls = LimdeskApi::Client.all
|
|
93
93
|
cls.first.name
|
94
94
|
"John Smith"
|
95
95
|
|
96
|
-
client = LimdeskApi::Client.create name: "John Smith",
|
96
|
+
client = LimdeskApi::Client.create name: "John Smith",
|
97
97
|
nippesel: "15012406496",
|
98
98
|
phone: "223111789",
|
99
99
|
email: "email@example.com",
|
100
|
-
|
100
|
+
address: "Plain Street 149 85-058 Warsaw"
|
101
101
|
client.delete!
|
102
102
|
true
|
103
103
|
|
104
104
|
client2 = LimdeskApi::Client.get(55)
|
105
105
|
client2.contacts.first
|
106
106
|
|
107
|
+
client2.update name: "John Smith 2",
|
108
|
+
nippesel: "123",
|
109
|
+
phone: "11111",
|
110
|
+
email: "emailnew@example.com",
|
111
|
+
address: "Plain Street 149 85-058 Warsaw"
|
112
|
+
true
|
113
|
+
|
114
|
+
client3 = LimdeskApi::Client.get_by_email('adam@example.com')
|
115
|
+
client4 = LimdeskApi::Client.get_by_phone('+48897228989')
|
107
116
|
```
|
108
117
|
|
109
118
|
#### Sales
|
data/lib/limdesk_api/client.rb
CHANGED
@@ -14,5 +14,47 @@ module LimdeskApi
|
|
14
14
|
def self.create(params)
|
15
15
|
super
|
16
16
|
end
|
17
|
+
|
18
|
+
# Gets a Client by property
|
19
|
+
#
|
20
|
+
# @param [String] action search type
|
21
|
+
# @param [String] query search data
|
22
|
+
#
|
23
|
+
# @return [LimdeskApi::Client]
|
24
|
+
def self.get_by(action, query)
|
25
|
+
response = LimdeskApi.get_one object: object_symbol,
|
26
|
+
action: action,
|
27
|
+
query: query
|
28
|
+
response ? new(response) : nil
|
29
|
+
end
|
30
|
+
|
31
|
+
# Gets a Client by e-mail
|
32
|
+
#
|
33
|
+
# @param [String] email find by e-mail
|
34
|
+
#
|
35
|
+
# @return [LimdeskApi::Client]
|
36
|
+
def self.get_by_email(email)
|
37
|
+
get_by('get_by_email', email)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Gets a Client by phone
|
41
|
+
#
|
42
|
+
# @param [String] phone find by phone
|
43
|
+
#
|
44
|
+
# @return [LimdeskApi::Client]
|
45
|
+
def self.get_by_phone(phone)
|
46
|
+
get_by('get_by_phone', phone)
|
47
|
+
end
|
48
|
+
|
49
|
+
# updates a client
|
50
|
+
#
|
51
|
+
# @param [Hash] params new client data
|
52
|
+
#
|
53
|
+
# @return [LimdeskApi::Client]
|
54
|
+
def update(params)
|
55
|
+
LimdeskApi.put object: object_symbol,
|
56
|
+
params: params,
|
57
|
+
id: id
|
58
|
+
end
|
17
59
|
end
|
18
60
|
end
|
@@ -10,8 +10,8 @@ module LimdeskApi
|
|
10
10
|
# @return [LimdeskApi::Client]
|
11
11
|
# @return [LimdeskApi::Sale]
|
12
12
|
def self.get(id)
|
13
|
-
response = LimdeskApi.get_one(object:
|
14
|
-
response ?
|
13
|
+
response = LimdeskApi.get_one(object: object_symbol, id: id)
|
14
|
+
response ? new(response) : nil
|
15
15
|
end
|
16
16
|
|
17
17
|
# Creates an object by LimdeskAPI
|
@@ -22,8 +22,8 @@ module LimdeskApi
|
|
22
22
|
# @return [LimdeskApi::Client]
|
23
23
|
# @return [LimdeskApi::Sale]
|
24
24
|
def self.create(params)
|
25
|
-
response = LimdeskApi.create(object:
|
26
|
-
|
25
|
+
response = LimdeskApi.create(object: object_symbol, params: params)
|
26
|
+
new response
|
27
27
|
end
|
28
28
|
|
29
29
|
# Gets all objects of a type from LimdeskAPI
|
@@ -33,13 +33,13 @@ module LimdeskApi
|
|
33
33
|
# @return [Array<LimdeskApi::Sale>]
|
34
34
|
# @return [Array<LimdeskApi::Activity>]
|
35
35
|
def self.all
|
36
|
-
LimdeskApi.get_all(
|
36
|
+
LimdeskApi.get_all(object_symbol).map { |obj| new obj }
|
37
37
|
end
|
38
38
|
|
39
39
|
# Helper - get class name as a symbol
|
40
40
|
# @return [Symbol]
|
41
41
|
def self.object_symbol
|
42
|
-
|
42
|
+
name.downcase.split(':').last.to_sym
|
43
43
|
end
|
44
44
|
|
45
45
|
# Force object to refresh itself from LimdeskAPI
|
@@ -48,7 +48,7 @@ module LimdeskApi
|
|
48
48
|
# @return [LimdeskApi::Client]
|
49
49
|
# @return [LimdeskApi::Sale]
|
50
50
|
def refresh!
|
51
|
-
|
51
|
+
marshal_load(self.class.get(self['id']).marshal_dump)
|
52
52
|
end
|
53
53
|
|
54
54
|
# Delete an object by LimdeskAPI
|
data/lib/limdesk_api/ticket.rb
CHANGED
@@ -37,7 +37,7 @@ module LimdeskApi
|
|
37
37
|
# Refreshes the object from the server
|
38
38
|
# @return [LimdeskApi::Ticket]
|
39
39
|
def refresh!
|
40
|
-
|
40
|
+
marshal_load(Ticket.get(self['number']).marshal_dump)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Closes a ticket
|
@@ -66,7 +66,7 @@ module LimdeskApi
|
|
66
66
|
# @return [Boolean]
|
67
67
|
def reopen
|
68
68
|
response = LimdeskApi.put(
|
69
|
-
id:
|
69
|
+
id: number,
|
70
70
|
object: :ticket,
|
71
71
|
action: :reopen,
|
72
72
|
params: {})
|
@@ -85,7 +85,7 @@ module LimdeskApi
|
|
85
85
|
fail 'BadAnswerType' unless Ticket::ANSWER_TYPES.keys.include?(params[:answer_type])
|
86
86
|
params['type'] = Ticket::ANSWER_TYPES[params.delete(:answer_type)]
|
87
87
|
response = LimdeskApi.post_simple(
|
88
|
-
id:
|
88
|
+
id: number,
|
89
89
|
object: :ticket,
|
90
90
|
action: :answer,
|
91
91
|
params: params)
|
data/lib/limdesk_api/version.rb
CHANGED
data/lib/limdesk_api.rb
CHANGED
@@ -69,6 +69,7 @@ module LimdeskApi
|
|
69
69
|
resp = @connection.get do |req|
|
70
70
|
req.url generate_url params
|
71
71
|
req.params[:key] = @key
|
72
|
+
req.params[:query] = params[:query] if params[:query]
|
72
73
|
end
|
73
74
|
case resp.status
|
74
75
|
when 200
|
@@ -181,14 +182,14 @@ module LimdeskApi
|
|
181
182
|
end
|
182
183
|
|
183
184
|
def self.put(params)
|
184
|
-
|
185
|
+
update(:put, params)
|
185
186
|
end
|
186
187
|
|
187
188
|
def self.post_simple(params)
|
188
|
-
|
189
|
+
update(:post, params)
|
189
190
|
end
|
190
191
|
|
191
192
|
def self.delete(params)
|
192
|
-
|
193
|
+
update(:delete, params)
|
193
194
|
end
|
194
195
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limdesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Siehień
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|