desk_api 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 707504b6574f986733536a110fcb6e62d9e21fdc
4
- data.tar.gz: 83018510d73d59c23fc2e867729a9317939d1ab0
3
+ metadata.gz: bd267e380566167aae73f9d0b26d8d84e72b1749
4
+ data.tar.gz: deaee7be024ea5238866cb2e8fab1e8e579cbe25
5
5
  SHA512:
6
- metadata.gz: cc4d3a9536f1e49d1d0ff7d9d860e8e9a897bc718f663682bd103fd1dc3db06ed52a1637ada19431af765160fa40c03cdf19bcf68184cb37aee8348a1a20a3bd
7
- data.tar.gz: de81f51bc700975c8ed46394fa47b13a69e420a1f2c86e6665fa48d201fa1e139ee94f93f6ec9c76b643efbdd2dbf0230924b1b4cf20964ef8edf46a5b3bb24a
6
+ metadata.gz: 0319000b143117a540561e855ee3f03adcb46a85db1ff87567d0702dd0cc9a7ac9978bca858a642e677ca39f22d8d60dc513f7c452b8a3b4788725db431f7a09
7
+ data.tar.gz: abde08faf56067f3fbea77028ef954dd04cf8f6dbcab698d6deb07fe13711570f0742f07dfa9d60a716d611bf0a7bd040e84f1ad973f3fe98db6e6f38bfc8821
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ .DS_Store
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+ Gemfile.lock
20
+ .rvmrc
21
+ *~
22
+ backup
23
+ config.rb
data/desk_api.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency('multi_json')
24
24
  gem.add_runtime_dependency('faraday')
25
25
  gem.add_runtime_dependency('faraday_middleware')
26
+ gem.add_runtime_dependency('simple_oauth')
26
27
  gem.add_runtime_dependency('typhoeus')
27
28
  gem.add_runtime_dependency('addressable')
28
29
  gem.add_runtime_dependency('activesupport')
@@ -1,7 +1,7 @@
1
1
  module DeskApi
2
2
  module Action
3
3
  module Embedded
4
- protected
4
+ private
5
5
  def setup_embedded(entries)
6
6
  @records = entries.map do |record|
7
7
  resource(record._links.self['class']).new(client, record, true)
@@ -1,7 +1,7 @@
1
1
  module DeskApi
2
2
  module Action
3
3
  module Field
4
- protected
4
+ private
5
5
  # Handles the _links part of the HAL response and sets up the associations.
6
6
  # It is used by the client to setup the initial resources like `users`, `cases` and
7
7
  # so on, as well as by the resource object itself for sub resources (`cases.replies`).
@@ -1,7 +1,7 @@
1
1
  module DeskApi
2
2
  module Action
3
3
  module Link
4
- protected
4
+ private
5
5
  attr_accessor :_links
6
6
  # Handles the _links part of the HAL response and sets up the associations.
7
7
  # It is used by the client to setup the initial resources like `users`, `cases` and
@@ -18,7 +18,7 @@ module DeskApi
18
18
  # this is a really ugly hack but necessary for sub resources which aren't declared consistently
19
19
  definition['class'] = 'page' if method.pluralize == method
20
20
  # get the client
21
- client = self.instance_of?(DeskApi::Client) ? self : self.client
21
+ client = self.instance_of?(DeskApi::Client) ? self : @client
22
22
  # create the new resource
23
23
  @_links[method]['resource'] = resource(definition['class']).new client, Hashie::Mash.new({ _links: { self: definition } })
24
24
  end
@@ -1,7 +1,7 @@
1
1
  module DeskApi
2
2
  module Action
3
3
  module Resource
4
- protected
4
+ private
5
5
  def resource(name)
6
6
  require "desk_api/resource/#{name}"
7
7
  "DeskApi::Resource::#{name.classify}".constantize
@@ -41,9 +41,9 @@ module DeskApi
41
41
 
42
42
  def middleware
43
43
  @middleware ||= Proc.new do |builder|
44
+ builder.request :json
44
45
  builder.request :basic_auth, @username, @password if basic_auth.values.all?
45
46
  builder.request :oauth, oauth if oauth.values.all?
46
- builder.request :json
47
47
  builder.request :retry
48
48
 
49
49
  builder.response :mashify
@@ -29,7 +29,20 @@ module DeskApi
29
29
  @_links.self
30
30
  end
31
31
 
32
+ def get_href
33
+ get_self['href']
34
+ end
35
+
32
36
  protected
37
+
38
+ def exec!(reload = false)
39
+ return self if loaded and !reload
40
+ definition, @loaded = client.get(@_links.self.href).body, true
41
+ setup(definition)
42
+ end
43
+
44
+ private
45
+
33
46
  attr_accessor :client, :loaded, :_changed
34
47
 
35
48
  def setup(definition)
@@ -38,16 +51,11 @@ module DeskApi
38
51
  self
39
52
  end
40
53
 
41
- def exec!(reload = false)
42
- return self if loaded and !reload
43
- definition, @loaded = client.get(@_links.self.href).body, true
44
- setup(definition)
45
- end
46
-
47
54
  def method_missing(method, *args, &block)
48
55
  self.exec! if !loaded
49
56
  raise DeskApi::Error::MethodNotSupported unless self.respond_to?(method.to_sym)
50
57
  self.send(method, *args, &block)
51
58
  end
59
+
52
60
  end
53
61
  end
@@ -1,3 +1,3 @@
1
1
  module DeskApi
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://devel.desk.com/api/v2/topics/558245
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.0
14
+ response:
15
+ status:
16
+ code: 204
17
+ message:
18
+ headers:
19
+ Accept-Ranges:
20
+ - bytes
21
+ Cache-Control:
22
+ - no-cache
23
+ Date:
24
+ - Mon, 19 Aug 2013 23:53:31 GMT
25
+ Status:
26
+ - 204 No Content
27
+ Vary:
28
+ - X-AppVersion
29
+ X-AppVersion:
30
+ - '7.9'
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Rate-Limit-Limit:
34
+ - '60'
35
+ X-Rate-Limit-Remaining:
36
+ - '59'
37
+ X-Rate-Limit-Reset:
38
+ - '29'
39
+ X-Request-Id:
40
+ - d699571cf1eeca0714f02b9ee61bcbd8
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: ''
46
+ http_version:
47
+ recorded_at: Mon, 19 Aug 2013 23:53:31 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://devel.desk.com/api/v2/cases/3014
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ Accept-Ranges:
20
+ - bytes
21
+ Cache-Control:
22
+ - must-revalidate, private, max-age=0
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Tue, 03 Sep 2013 02:04:32 GMT
27
+ ETag:
28
+ - '"31cb249bf0be971be83b891b995e19f4"'
29
+ Status:
30
+ - 200 OK
31
+ Vary:
32
+ - X-AppVersion
33
+ X-AppVersion:
34
+ - '9.3'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ X-Rate-Limit-Limit:
38
+ - '60'
39
+ X-Rate-Limit-Remaining:
40
+ - '58'
41
+ X-Rate-Limit-Reset:
42
+ - '28'
43
+ X-Request-Id:
44
+ - ce49e111e53586ae4d813d378210d171
45
+ Content-Length:
46
+ - '942'
47
+ Connection:
48
+ - keep-alive
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"external_id":"","subject":"Testing Quick Case","priority":8,"locked_until":null,"description":"Some
52
+ additional Description regarding this email.","status":"resolved","type":"email","labels":[],"language":"de","active_at":"2013-05-10T19:08:27Z","created_at":"2013-05-10T19:08:10Z","updated_at":"2013-05-10T19:08:10Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3014","class":"case"},"message":{"href":"/api/v2/cases/3014/message","class":"email"},"customer":{"href":"/api/v2/customers/37823480","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3014/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3014/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3014/attachments","class":"attachment"}}}'
53
+ http_version:
54
+ recorded_at: Tue, 03 Sep 2013 02:04:32 GMT
55
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://devel.desk.com/api/v2/topics/556402
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Test Updated Topic"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Tue, 03 Sep 2013 02:04:32 GMT
27
+ ETag:
28
+ - '"00b667764701df60d557676ad7c34b48"'
29
+ Server:
30
+ - nginx
31
+ Status:
32
+ - 200 OK
33
+ Vary:
34
+ - X-AppVersion
35
+ X-AppVersion:
36
+ - '9.3'
37
+ X-Frame-Options:
38
+ - SAMEORIGIN
39
+ X-Rack-Cache:
40
+ - invalidate, pass
41
+ X-Rate-Limit-Limit:
42
+ - '60'
43
+ X-Rate-Limit-Remaining:
44
+ - '56'
45
+ X-Rate-Limit-Reset:
46
+ - '28'
47
+ X-Request-Id:
48
+ - 281edd664cb63fae8328885ad2f2c3f3
49
+ X-Runtime:
50
+ - '0.119752'
51
+ X-UA-Compatible:
52
+ - IE=Edge,chrome=1
53
+ Content-Length:
54
+ - '408'
55
+ Connection:
56
+ - keep-alive
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"name":"Test Updated Topic","description":null,"position":2,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-14T19:37:08Z","updated_at":"2013-08-19T23:53:31Z","_links":{"self":{"href":"/api/v2/topics/556402","class":"topic"},"articles":{"href":"/api/v2/topics/556402/articles","class":"article"},"translations":{"href":"/api/v2/topics/556402/translations","class":"topic_translation"}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 02:04:32 GMT
62
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://devel.desk.com/api/v2/topics
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Test Topic"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 201
19
+ message:
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Tue, 03 Sep 2013 02:04:32 GMT
29
+ ETag:
30
+ - '"94aa10fb0bdaf6f3b7f7d3fe3d8eecb6"'
31
+ Location:
32
+ - https://devel.desk.com/api/v2/topics/563658
33
+ Status:
34
+ - 201 Created
35
+ Vary:
36
+ - X-AppVersion
37
+ X-AppVersion:
38
+ - '9.3'
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Rate-Limit-Limit:
42
+ - '60'
43
+ X-Rate-Limit-Remaining:
44
+ - '57'
45
+ X-Rate-Limit-Reset:
46
+ - '28'
47
+ X-Request-Id:
48
+ - 3cefaedc8bdab8fa49b4d7e717c6d2f7
49
+ Content-Length:
50
+ - '400'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"name":"Test Topic","description":null,"position":5,"allow_questions":true,"in_support_center":null,"created_at":"2013-09-03T02:04:32Z","updated_at":"2013-09-03T02:04:32Z","_links":{"self":{"href":"/api/v2/topics/563658","class":"topic"},"articles":{"href":"/api/v2/topics/563658/articles","class":"article"},"translations":{"href":"/api/v2/topics/563658/translations","class":"topic_translation"}}}'
56
+ http_version:
57
+ recorded_at: Tue, 03 Sep 2013 02:04:32 GMT
58
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://devel.desk.com/api/v2/articles/1285134
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ response:
15
+ status:
16
+ code: 204
17
+ message:
18
+ headers:
19
+ Accept-Ranges:
20
+ - bytes
21
+ Cache-Control:
22
+ - no-cache
23
+ Date:
24
+ - Tue, 03 Sep 2013 02:20:19 GMT
25
+ Status:
26
+ - 204 No Content
27
+ Vary:
28
+ - X-AppVersion
29
+ X-AppVersion:
30
+ - '9.3'
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Rate-Limit-Limit:
34
+ - '60'
35
+ X-Rate-Limit-Remaining:
36
+ - '58'
37
+ X-Rate-Limit-Reset:
38
+ - '41'
39
+ X-Request-Id:
40
+ - a579a1b17fefdde589fd2b3af0dbcb9e
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: ''
46
+ http_version:
47
+ recorded_at: Tue, 03 Sep 2013 02:20:19 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,313 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://devel.desk.com/api/v2/articles/1213277
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ Accept-Ranges:
20
+ - bytes
21
+ Cache-Control:
22
+ - must-revalidate, private, max-age=0
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Tue, 03 Sep 2013 02:17:51 GMT
27
+ ETag:
28
+ - '"9c195d070361a74830027d6597f70068"'
29
+ Status:
30
+ - 200 OK
31
+ Vary:
32
+ - X-AppVersion
33
+ X-AppVersion:
34
+ - '9.3'
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ X-Rate-Limit-Limit:
38
+ - '60'
39
+ X-Rate-Limit-Remaining:
40
+ - '58'
41
+ X-Rate-Limit-Reset:
42
+ - '9'
43
+ X-Request-Id:
44
+ - 625479549c10e650e4f6ff0c775fc9d1
45
+ Content-Length:
46
+ - '20825'
47
+ Connection:
48
+ - keep-alive
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"subject":"asdf","body":"<div>\r\n<div class=\"lc\">\r\n<p><strong>Lorem
52
+ Ipsum</strong>&nbsp;is simply dummy text of the printing and typesetting industry.
53
+ Lorem Ipsum has been the industry&#39;s standard dummy text ever since the
54
+ 1500s, when an unknown printer took a galley of type and scrambled it to make
55
+ a type specimen book. It has survived not only five centuries, but also the
56
+ leap into electronic typesetting, remaining essentially unchanged. It was
57
+ popularised in the 1960s with the release of Letraset sheets containing Lorem
58
+ Ipsum passages, and more recently with desktop publishing software like Aldus
59
+ PageMaker including versions of Lorem Ipsum.</p>\r\n</div>\r\n\r\n<div class=\"rc\">\r\n<h2
60
+ class=\"why\">&nbsp;</h2>\r\n\r\n<p>It is a long established fact that a reader
61
+ will be distracted by the readable content of a page when looking at its layout.
62
+ The point of using Lorem Ipsum is that it has a more-or-less normal distribution
63
+ of letters, as opposed to using &#39;Content here, content here&#39;, making
64
+ it look like readable English. Many desktop publishing packages and web page
65
+ editors now use Lorem Ipsum as their default model text, and a search for
66
+ &#39;lorem ipsum&#39; will uncover many web sites still in their infancy.
67
+ Various versions have evolved over the years, sometimes by accident, sometimes
68
+ on purpose (injected humour and the like).</p>\r\n</div>\r\n</div>\r\n<span
69
+ style=\"color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans; font-size:
70
+ 11px; line-height: normal; text-align: center;\">&nbsp;</span>\r\n\r\n<div>\r\n<div
71
+ class=\"lc\">\r\n<h2 class=\"where\">&nbsp;</h2>\r\n\r\n<p>Contrary to popular
72
+ belief, Lorem Ipsum is not simply random text. It has roots in a piece of
73
+ classical Latin literature from 45 BC, making it over 2000 years old. Richard
74
+ McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked
75
+ up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage,
76
+ and going through the cites of the word in classical literature, discovered
77
+ the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33
78
+ of &quot;de Finibus Bonorum et Malorum&quot; (The Extremes of Good and Evil)
79
+ by Cicero, written in 45 BC. This book is a treatise on the theory of ethics,
80
+ very popular during the Renaissance. The first line of Lorem Ipsum, &quot;Lorem
81
+ ipsum dolor sit amet..&quot;, comes from a line in section 1.10.32.</p>\r\n\r\n<p>The
82
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
83
+ those interested. Sections 1.10.32 and 1.10.33 from &quot;de Finibus Bonorum
84
+ et Malorum&quot; by Cicero are also reproduced in their exact original form,
85
+ accompanied by English versions from the 1914 translation by H. Rackham.</p>\r\n</div>\r\n\r\n<div
86
+ class=\"rc\">\r\n<h2 class=\"getsome\">&nbsp;</h2>\r\n\r\n<p>There are many
87
+ variations of passages of Lorem Ipsum available, but the majority have suffered
88
+ alteration in some form, by injected humour, or randomised words which don&#39;t
89
+ look even slightly believable. If you are going to use a passage of Lorem
90
+ Ipsum, you need to be sure there isn&#39;t anything embarrassing hidden in
91
+ the middle of text. All the Lorem Ipsum generators on the Internet tend to
92
+ repeat predefined chunks as necessary, making this the first true generator
93
+ on the Internet. It uses a dictionary of over 200 Latin words, combined with
94
+ a handful of model sentence structures, to generate Lorem Ipsum which looks
95
+ reasonable. The generated Lorem Ipsum is therefore always free from repetition,
96
+ injected humour, or non-characteristic words etc.</p>\r\n</div>\r\n</div>\r\n","body_email":"Lorem
97
+ Ipsum is simply dummy text of the printing and typesetting industry. Lorem
98
+ Ipsum has been the industry''s standard dummy text ever since the 1500s, when
99
+ an unknown printer took a galley of type and scrambled it to make a type specimen
100
+ book. It has survived not only five centuries, but also the leap into electronic
101
+ typesetting, remaining essentially unchanged. It was popularised in the 1960s
102
+ with the release of Letraset sheets containing Lorem Ipsum passages, and more
103
+ recently with desktop publishing software like Aldus PageMaker including versions
104
+ of Lorem Ipsum. \r\n \r\n\r\n \r\n \r\n\r\n It is a long established fact
105
+ that a reader will be distracted by the readable content of a page when looking
106
+ at its layout. The point of using Lorem Ipsum is that it has a more-or-less
107
+ normal distribution of letters, as opposed to using ''Content here, content
108
+ here'', making it look like readable English. Many desktop publishing packages
109
+ and web page editors now use Lorem Ipsum as their default model text, and
110
+ a search for ''lorem ipsum'' will uncover many web sites still in their infancy.
111
+ Various versions have evolved over the years, sometimes by accident, sometimes
112
+ on purpose (injected humour and the like). \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n
113
+ Contrary to popular belief, Lorem Ipsum is not simply random text. It has
114
+ roots in a piece of classical Latin literature from 45 BC, making it over
115
+ 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
116
+ in Virginia, looked up one of the more obscure Latin words, consectetur, from
117
+ a Lorem Ipsum passage, and going through the cites of the word in classical
118
+ literature, discovered the undoubtable source. Lorem Ipsum comes from sections
119
+ 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of
120
+ Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the
121
+ theory of ethics, very popular during the Renaissance. The first line of Lorem
122
+ Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n\nThe
123
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
124
+ those interested. Sections 1.10.32 and 1.10.33 from \"de Finibus Bonorum et
125
+ Malorum\" by Cicero are also reproduced in their exact original form, accompanied
126
+ by English versions from the 1914 translation by H. Rackham. \r\n \r\n\r\n
127
+ \r\n \r\n\r\n There are many variations of passages of Lorem Ipsum available,
128
+ but the majority have suffered alteration in some form, by injected humour,
129
+ or randomised words which don''t look even slightly believable. If you are
130
+ going to use a passage of Lorem Ipsum, you need to be sure there isn''t anything
131
+ embarrassing hidden in the middle of text. All the Lorem Ipsum generators
132
+ on the Internet tend to repeat predefined chunks as necessary, making this
133
+ the first true generator on the Internet. It uses a dictionary of over 200
134
+ Latin words, combined with a handful of model sentence structures, to generate
135
+ Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore
136
+ always free from repetition, injected humour, or non-characteristic words
137
+ etc.","body_email_auto":true,"body_chat":"Lorem Ipsum is simply dummy text
138
+ of the printing and typesetting industry. Lorem Ipsum has been the industry''s
139
+ standard dummy text ever since the 1500s, when an unknown printer took a galley
140
+ of type and scrambled it to make a type specimen book. It h... http://devel.desk.com/customer/portal/articles/1213277-asdf","body_chat_auto":true,"body_web_callback":"<div>\r\n<div
141
+ class=\"lc\">\r\n<p><strong>Lorem Ipsum</strong>&nbsp;is simply dummy text
142
+ of the printing and typesetting industry. Lorem Ipsum has been the industry&#39;s
143
+ standard dummy text ever since the 1500s, when an unknown printer took a galley
144
+ of type and scrambled it to make a type specimen book. It has survived not
145
+ only five centuries, but also the leap into electronic typesetting, remaining
146
+ essentially unchanged. It was popularised in the 1960s with the release of
147
+ Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
148
+ publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>\r\n</div>\r\n\r\n<div
149
+ class=\"rc\">\r\n<h2 class=\"why\">&nbsp;</h2>\r\n\r\n<p>It is a long established
150
+ fact that a reader will be distracted by the readable content of a page when
151
+ looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less
152
+ normal distribution of letters, as opposed to using &#39;Content here, content
153
+ here&#39;, making it look like readable English. Many desktop publishing packages
154
+ and web page editors now use Lorem Ipsum as their default model text, and
155
+ a search for &#39;lorem ipsum&#39; will uncover many web sites still in their
156
+ infancy. Various versions have evolved over the years, sometimes by accident,
157
+ sometimes on purpose (injected humour and the like).</p>\r\n</div>\r\n</div>\r\n<span
158
+ style=\"color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans; font-size:
159
+ 11px; line-height: normal; text-align: center;\">&nbsp;</span>\r\n\r\n<div>\r\n<div
160
+ class=\"lc\">\r\n<h2 class=\"where\">&nbsp;</h2>\r\n\r\n<p>Contrary to popular
161
+ belief, Lorem Ipsum is not simply random text. It has roots in a piece of
162
+ classical Latin literature from 45 BC, making it over 2000 years old. Richard
163
+ McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked
164
+ up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage,
165
+ and going through the cites of the word in classical literature, discovered
166
+ the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33
167
+ of &quot;de Finibus Bonorum et Malorum&quot; (The Extremes of Good and Evil)
168
+ by Cicero, written in 45 BC. This book is a treatise on the theory of ethics,
169
+ very popular during the Renaissance. The first line of Lorem Ipsum, &quot;Lorem
170
+ ipsum dolor sit amet..&quot;, comes from a line in section 1.10.32.</p>\r\n\r\n<p>The
171
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
172
+ those interested. Sections 1.10.32 and 1.10.33 from &quot;de Finibus Bonorum
173
+ et Malorum&quot; by Cicero are also reproduced in their exact original form,
174
+ accompanied by English versions from the 1914 translation by H. Rackham.</p>\r\n</div>\r\n\r\n<div
175
+ class=\"rc\">\r\n<h2 class=\"getsome\">&nbsp;</h2>\r\n\r\n<p>There are many
176
+ variations of passages of Lorem Ipsum available, but the majority have suffered
177
+ alteration in some form, by injected humour, or randomised words which don&#39;t
178
+ look even slightly believable. If you are going to use a passage of Lorem
179
+ Ipsum, you need to be sure there isn&#39;t anything embarrassing hidden in
180
+ the middle of text. All the Lorem Ipsum generators on the Internet tend to
181
+ repeat predefined chunks as necessary, making this the first true generator
182
+ on the Internet. It uses a dictionary of over 200 Latin words, combined with
183
+ a handful of model sentence structures, to generate Lorem Ipsum which looks
184
+ reasonable. The generated Lorem Ipsum is therefore always free from repetition,
185
+ injected humour, or non-characteristic words etc.</p>\r\n</div>\r\n</div>\r\n","body_web_callback_auto":true,"body_twitter":"Lorem
186
+ Ipsum is simply dummy text of the printing and typesetting industry. Lorem
187
+ Ipsum has been the in... http://devel.desk.com/customer/portal/articles/1213277-asdf","body_twitter_auto":true,"body_qna":"Lorem
188
+ Ipsum is simply dummy text of the printing and typesetting industry. Lorem
189
+ Ipsum has been the industry''s standard dummy text ever since the 1500s, when
190
+ an unknown printer took a galley of type and scrambled it to make a type specimen
191
+ book. It has survived not only five centuries, but also the leap into electronic
192
+ typesetting, remaining essentially unchanged. It was popularised in the 1960s
193
+ with the release of Letraset sheets containing Lorem Ipsum passages, and more
194
+ recently with desktop publishing software like Aldus PageMaker including versions
195
+ of Lorem Ipsum. \r\n \r\n\r\n \r\n \r\n\r\n It is a long established fact
196
+ that a reader will be distracted by the readable content of a page when looking
197
+ at its layout. The point of using Lorem Ipsum is that it has a more-or-less
198
+ normal distribution of letters, as opposed to using ''Content here, content
199
+ here'', making it look like readable English. Many desktop publishing packages
200
+ and web page editors now use Lorem Ipsum as their default model text, and
201
+ a search for ''lorem ipsum'' will uncover many web sites still in their infancy.
202
+ Various versions have evolved over the years, sometimes by accident, sometimes
203
+ on purpose (injected humour and the like). \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n
204
+ Contrary to popular belief, Lorem Ipsum is not simply random text. It has
205
+ roots in a piece of classical Latin literature from 45 BC, making it over
206
+ 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
207
+ in Virginia, looked up one of the more obscure Latin words, consectetur, from
208
+ a Lorem Ipsum passage, and going through the cites of the word in classical
209
+ literature, discovered the undoubtable source. Lorem Ipsum comes from sections
210
+ 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of
211
+ Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the
212
+ theory of ethics, very popular during the Renaissance. The first line of Lorem
213
+ Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n\nThe
214
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
215
+ those interested. Sections 1.10.32 and 1.10.33 from \"de Finibus Bonorum et
216
+ Malorum\" by Cicero are also reproduced in their exact original form, accompanied
217
+ by English versions from the 1914 translation by H. Rackham. \r\n \r\n\r\n
218
+ \r\n \r\n\r\n There are many variations of passages of Lorem Ipsum available,
219
+ but the majority have suffered alteration in some form, by injected humour,
220
+ or randomised words which don''t look even slightly believable. If you are
221
+ going to use a passage of Lorem Ipsum, you need to be sure there isn''t anything
222
+ embarrassing hidden in the middle of text. All the Lorem Ipsum generators
223
+ on the Internet tend to repeat predefined chunks as necessary, making this
224
+ the first true generator on the Internet. It uses a dictionary of over 200
225
+ Latin words, combined with a handful of model sentence structures, to generate
226
+ Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore
227
+ always free from repetition, injected humour, or non-characteristic words
228
+ etc.","body_qna_auto":true,"body_phone":"Lorem Ipsum is simply dummy text
229
+ of the printing and typesetting industry. Lorem Ipsum has been the industry''s
230
+ standard dummy text ever since the 1500s, when an unknown printer took a galley
231
+ of type and scrambled it to make a type specimen book. It has survived not
232
+ only five centuries, but also the leap into electronic typesetting, remaining
233
+ essentially unchanged. It was popularised in the 1960s with the release of
234
+ Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
235
+ publishing software like Aldus PageMaker including versions of Lorem Ipsum.
236
+ \r\n \r\n\r\n \r\n \r\n\r\n It is a long established fact that a reader
237
+ will be distracted by the readable content of a page when looking at its layout.
238
+ The point of using Lorem Ipsum is that it has a more-or-less normal distribution
239
+ of letters, as opposed to using ''Content here, content here'', making it
240
+ look like readable English. Many desktop publishing packages and web page
241
+ editors now use Lorem Ipsum as their default model text, and a search for
242
+ ''lorem ipsum'' will uncover many web sites still in their infancy. Various
243
+ versions have evolved over the years, sometimes by accident, sometimes on
244
+ purpose (injected humour and the like). \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n
245
+ Contrary to popular belief, Lorem Ipsum is not simply random text. It has
246
+ roots in a piece of classical Latin literature from 45 BC, making it over
247
+ 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
248
+ in Virginia, looked up one of the more obscure Latin words, consectetur, from
249
+ a Lorem Ipsum passage, and going through the cites of the word in classical
250
+ literature, discovered the undoubtable source. Lorem Ipsum comes from sections
251
+ 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of
252
+ Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the
253
+ theory of ethics, very popular during the Renaissance. The first line of Lorem
254
+ Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n\nThe
255
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
256
+ those interested. Sections 1.10.32 and 1.10.33 from \"de Finibus Bonorum et
257
+ Malorum\" by Cicero are also reproduced in their exact original form, accompanied
258
+ by English versions from the 1914 translation by H. Rackham. \r\n \r\n\r\n
259
+ \r\n \r\n\r\n There are many variations of passages of Lorem Ipsum available,
260
+ but the majority have suffered alteration in some form, by injected humour,
261
+ or randomised words which don''t look even slightly believable. If you are
262
+ going to use a passage of Lorem Ipsum, you need to be sure there isn''t anything
263
+ embarrassing hidden in the middle of text. All the Lorem Ipsum generators
264
+ on the Internet tend to repeat predefined chunks as necessary, making this
265
+ the first true generator on the Internet. It uses a dictionary of over 200
266
+ Latin words, combined with a handful of model sentence structures, to generate
267
+ Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore
268
+ always free from repetition, injected humour, or non-characteristic words
269
+ etc.","body_phone_auto":true,"body_facebook":"Lorem Ipsum is simply dummy
270
+ text of the printing and typesetting industry. Lorem Ipsum has been the industry''s
271
+ standard dummy text ever since the 1500s, when an unknown printer took a galley
272
+ of type and scrambled it to make a type specimen book. It has survived not
273
+ only five centuries, but also the leap into electronic typesetting, remaining
274
+ essentially unchanged. It was popularised in the 1960s with the release of
275
+ Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
276
+ publishing software like Aldus PageMaker including versions of Lorem Ipsum.
277
+ \r\n \r\n\r\n \r\n \r\n\r\n It is a long established fact that a reader
278
+ will be distracted by the readable content of a page when looking at its layout.
279
+ The point of using Lorem Ipsum is that it has a more-or-less normal distribution
280
+ of letters, as opposed to using ''Content here, content here'', making it
281
+ look like readable English. Many desktop publishing packages and web page
282
+ editors now use Lorem Ipsum as their default model text, and a search for
283
+ ''lorem ipsum'' will uncover many web sites still in their infancy. Various
284
+ versions have evolved over the years, sometimes by accident, sometimes on
285
+ purpose (injected humour and the like). \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n
286
+ Contrary to popular belief, Lorem Ipsum is not simply random text. It has
287
+ roots in a piece of classical Latin literature from 45 BC, making it over
288
+ 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
289
+ in Virginia, looked up one of the more obscure Latin words, consectetur, from
290
+ a Lorem Ipsum passage, and going through the cites of the word in classical
291
+ literature, discovered the undoubtable source. Lorem Ipsum comes from sections
292
+ 1.10.32 and 1.10.33 of \"de Finibus Bonorum et Malorum\" (The Extremes of
293
+ Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the
294
+ theory of ethics, very popular during the Renaissance. The first line of Lorem
295
+ Ipsum, \"Lorem ipsum dolor sit amet..\", comes from a line in section 1.10.32.\n\nThe
296
+ standard chunk of Lorem Ipsum used since the 1500s is reproduced below for
297
+ those interested. Sections 1.10.32 and 1.10.33 from \"de Finibus Bonorum et
298
+ Malorum\" by Cicero are also reproduced in their exact original form, accompanied
299
+ by English versions from the 1914 translation by H. Rackham. \r\n \r\n\r\n
300
+ \r\n \r\n\r\n There are many variations of passages of Lorem Ipsum available,
301
+ but the majority have suffered alteration in some form, by injected humour,
302
+ or randomised words which don''t look even slightly believable. If you are
303
+ going to use a passage of Lorem Ipsum, you need to be sure there isn''t anything
304
+ embarrassing hidden in the middle of text. All the Lorem Ipsum generators
305
+ on the Internet tend to repeat predefined chunks as necessary, making this
306
+ the first true generator on the Internet. It uses a dictionary of over 200
307
+ Latin words, combined with a handful of model sentence structures, to generate
308
+ Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore
309
+ always free from repetition, injected humour, or non-characteristic words
310
+ etc.","body_facebook_auto":true,"keywords":"","position":1,"quickcode":null,"in_support_center":true,"internal_notes":"","publish_at":"2013-08-05T01:13:36Z","created_at":"2013-07-05T15:45:25Z","updated_at":"2013-08-19T23:51:33Z","_links":{"self":{"href":"/api/v2/articles/1213277","class":"article"},"topic":{"href":"/api/v2/topics/498301","class":"topic"},"translations":{"href":"/api/v2/articles/1213277/translations","class":"article_translation"}}}'
311
+ http_version:
312
+ recorded_at: Tue, 03 Sep 2013 02:17:51 GMT
313
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,66 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://devel.desk.com/api/v2/articles/1285134
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"subject":"Testing Updated OAuth"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Tue, 03 Sep 2013 02:20:19 GMT
27
+ ETag:
28
+ - '"1fd66bbba076c29ce1c35f0a3252ea63"'
29
+ Server:
30
+ - nginx
31
+ Status:
32
+ - 200 OK
33
+ Vary:
34
+ - X-AppVersion
35
+ X-AppVersion:
36
+ - '9.3'
37
+ X-Frame-Options:
38
+ - SAMEORIGIN
39
+ X-Rack-Cache:
40
+ - invalidate, pass
41
+ X-Rate-Limit-Limit:
42
+ - '60'
43
+ X-Rate-Limit-Remaining:
44
+ - '59'
45
+ X-Rate-Limit-Reset:
46
+ - '41'
47
+ X-Request-Id:
48
+ - 3724d323e7831c1f47bb6bef6cd45d8b
49
+ X-Runtime:
50
+ - '0.181512'
51
+ X-UA-Compatible:
52
+ - IE=Edge,chrome=1
53
+ Content-Length:
54
+ - '814'
55
+ Connection:
56
+ - keep-alive
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"subject":"Testing Updated OAuth","body":"Some Body","body_email":"Some
60
+ Body","body_email_auto":true,"body_chat":"Some Body","body_chat_auto":true,"body_web_callback":"Some
61
+ Body","body_web_callback_auto":true,"body_twitter":"Some Body","body_twitter_auto":true,"body_qna":"Some
62
+ Body","body_qna_auto":true,"body_phone":"Some Body","body_phone_auto":true,"body_facebook":"Some
63
+ Body","body_facebook_auto":true,"keywords":null,"position":2,"quickcode":null,"in_support_center":null,"internal_notes":null,"publish_at":null,"created_at":"2013-09-03T01:31:09Z","updated_at":"2013-09-03T02:20:19Z","_links":{"self":{"href":"/api/v2/articles/1285134","class":"article"},"topic":{"href":"/api/v2/topics/498301","class":"topic"},"translations":{"href":"/api/v2/articles/1285134/translations","class":"article_translation"}}}'
64
+ http_version:
65
+ recorded_at: Tue, 03 Sep 2013 02:20:19 GMT
66
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://devel.desk.com/api/v2/articles
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"subject":"Testing OAuth","body":"OAuth testing","_links":{"topic":{"href":"/api/v2/topics/498301"}}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - desk.com Ruby Gem v0.1.1
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 201
19
+ message:
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Tue, 03 Sep 2013 02:21:47 GMT
29
+ ETag:
30
+ - '"2559b1e5a8ab953a72d4927d7cb2a272"'
31
+ Location:
32
+ - https://devel.desk.com/api/v2/articles/1285155
33
+ Status:
34
+ - 201 Created
35
+ Vary:
36
+ - X-AppVersion
37
+ X-AppVersion:
38
+ - '9.3'
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Rate-Limit-Limit:
42
+ - '60'
43
+ X-Rate-Limit-Remaining:
44
+ - '58'
45
+ X-Rate-Limit-Reset:
46
+ - '13'
47
+ X-Request-Id:
48
+ - 0032dd903f22cd59f6183911e4a0e425
49
+ Content-Length:
50
+ - '838'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"subject":"Testing OAuth","body":"OAuth testing","body_email":"OAuth
56
+ testing","body_email_auto":true,"body_chat":"OAuth testing","body_chat_auto":true,"body_web_callback":"OAuth
57
+ testing","body_web_callback_auto":true,"body_twitter":"OAuth testing","body_twitter_auto":true,"body_qna":"OAuth
58
+ testing","body_qna_auto":true,"body_phone":"OAuth testing","body_phone_auto":true,"body_facebook":"OAuth
59
+ testing","body_facebook_auto":true,"keywords":null,"position":2,"quickcode":null,"in_support_center":null,"internal_notes":null,"publish_at":null,"created_at":"2013-09-03T02:21:47Z","updated_at":"2013-09-03T02:21:47Z","_links":{"self":{"href":"/api/v2/articles/1285155","class":"article"},"topic":{"href":"/api/v2/topics/498301","class":"topic"},"translations":{"href":"/api/v2/articles/1285155/translations","class":"article_translation"}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 02:21:47 GMT
62
+ recorded_with: VCR 2.5.0
@@ -82,29 +82,65 @@ describe DeskApi::Client do
82
82
  end
83
83
  end
84
84
 
85
- describe '#get', :vcr do
86
- it 'fetches resources' do
87
- response = subject.get('/api/v2/cases/3014')
88
- response.body.subject.should eq('Testing Quick Case')
85
+ context 'using Basic Authentication' do
86
+ describe '#get', :vcr do
87
+ it 'fetches resources' do
88
+ response = subject.get('/api/v2/cases/3014')
89
+ response.body.subject.should eq('Testing Quick Case')
90
+ end
89
91
  end
90
- end
91
92
 
92
- describe '#post', :vcr do
93
- it 'creates a resource' do
94
- response = subject.post('/api/v2/topics', @topic_create_data)
95
- response.body.name.should eq(@topic_create_data[:name])
93
+ describe '#post', :vcr do
94
+ it 'creates a resource' do
95
+ response = subject.post('/api/v2/topics', @topic_create_data)
96
+ response.body.name.should eq(@topic_create_data[:name])
97
+ end
96
98
  end
97
- end
98
99
 
99
- describe '#patch', :vcr do
100
- it 'updates a resource' do
101
- subject.patch('/api/v2/topics/556402', @topic_update_data).body.name.should eq(@topic_update_data[:name])
100
+ describe '#patch', :vcr do
101
+ it 'updates a resource' do
102
+ subject.patch('/api/v2/topics/556402', @topic_update_data).body.name.should eq(@topic_update_data[:name])
103
+ end
104
+ end
105
+
106
+ describe '#delete', :vcr do
107
+ it 'deletes a resource' do
108
+ subject.delete('/api/v2/topics/558245').status.should eq(204)
109
+ end
102
110
  end
103
111
  end
104
112
 
105
- describe '#delete', :vcr do
106
- it 'deletes a resource' do
107
- subject.delete('/api/v2/topics/558245').status.should eq(204)
113
+ context 'using OAuth' do
114
+ before do
115
+ @client = DeskApi::Client.new DeskApi::OAUTH_CONFIG
116
+ @article_create_data = { subject: 'Testing OAuth', body: 'OAuth testing', _links: { topic: { href: '/api/v2/topics/498301' } } }
117
+ @article_update_data = { subject: 'Testing Updated OAuth' }
118
+ end
119
+
120
+ describe '#get', :vcr do
121
+ it 'fetches resources' do
122
+ response = @client.get('/api/v2/articles/1213277')
123
+ response.body.subject.should eq('asdf')
124
+ end
125
+ end
126
+
127
+ describe '#post', :vcr do
128
+ it 'creates a resource' do
129
+ response = @client.post('/api/v2/articles', @article_create_data)
130
+ response.body.subject.should eq(@article_create_data[:subject])
131
+ end
132
+ end
133
+
134
+ describe '#patch', :vcr do
135
+ it 'updates a resource' do
136
+ @client.patch('/api/v2/articles/1285134', @article_update_data).body.subject.should eq(@article_update_data[:subject])
137
+ end
138
+ end
139
+
140
+ describe '#delete', :vcr do
141
+ it 'deletes a resource' do
142
+ @client.delete('/api/v2/articles/1285134').status.should eq(204)
143
+ end
108
144
  end
109
145
  end
110
146
 
@@ -49,6 +49,21 @@ describe DeskApi::Resource do
49
49
  end
50
50
  end
51
51
 
52
+ context '#get_self' do
53
+ it 'returns the hash for self' do
54
+ subject.articles.get_self.should eq({
55
+ "href" => "/api/v2/articles",
56
+ "class" => "page"
57
+ })
58
+ end
59
+ end
60
+
61
+ context '#get_href' do
62
+ it 'returns the href for self' do
63
+ subject.articles.get_href.should eq('/api/v2/articles')
64
+ end
65
+ end
66
+
52
67
  context '#resource', :vcr do
53
68
  it 'requires the specified resource' do
54
69
  subject.send(:resource, 'article').should equal(DeskApi::Resource::Article)
data/spec/spec_helper.rb CHANGED
@@ -23,6 +23,14 @@ rescue LoadError
23
23
  password: '1234password',
24
24
  subdomain: 'devel'
25
25
  }
26
+
27
+ OAUTH_CONFIG = {
28
+ consumer_key: 'my_consumer_key',
29
+ consumer_secret: 'my_consumer_secret',
30
+ token: 'my_token',
31
+ token_secret: 'my_token_secret',
32
+ subdomain: 'devel'
33
+ }
26
34
  end
27
35
  end
28
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Stachl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simple_oauth
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: typhoeus
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +202,7 @@ extra_rdoc_files:
188
202
  - README.md
189
203
  files:
190
204
  - .coveralls.yml
205
+ - .gitignore
191
206
  - .rspec
192
207
  - .travis.yml
193
208
  - .yardopts
@@ -196,7 +211,6 @@ files:
196
211
  - LICENSE
197
212
  - README.md
198
213
  - Rakefile
199
- - config.rb
200
214
  - desk_api.gemspec
201
215
  - lib/desk.rb
202
216
  - lib/desk_api.rb
@@ -259,6 +273,14 @@ files:
259
273
  - spec/cassettes/DeskApi_Client/_get/fetches_resources.yml
260
274
  - spec/cassettes/DeskApi_Client/_patch/updates_a_resource.yml
261
275
  - spec/cassettes/DeskApi_Client/_post/creates_a_resource.yml
276
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_delete/deletes_a_resource.yml
277
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_get/fetches_resources.yml
278
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_patch/updates_a_resource.yml
279
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_post/creates_a_resource.yml
280
+ - spec/cassettes/DeskApi_Client/using_OAuth/_delete/deletes_a_resource.yml
281
+ - spec/cassettes/DeskApi_Client/using_OAuth/_get/fetches_resources.yml
282
+ - spec/cassettes/DeskApi_Client/using_OAuth/_patch/updates_a_resource.yml
283
+ - spec/cassettes/DeskApi_Client/using_OAuth/_post/creates_a_resource.yml
262
284
  - spec/cassettes/DeskApi_Error/_from_response/can_be_created_from_a_faraday_response.yml
263
285
  - spec/cassettes/DeskApi_Error/_from_response/uses_the_body_message_if_present.yml
264
286
  - spec/cassettes/DeskApi_Resource/_by_url/finds_resources_by_url.yml
@@ -319,6 +341,14 @@ test_files:
319
341
  - spec/cassettes/DeskApi_Client/_get/fetches_resources.yml
320
342
  - spec/cassettes/DeskApi_Client/_patch/updates_a_resource.yml
321
343
  - spec/cassettes/DeskApi_Client/_post/creates_a_resource.yml
344
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_delete/deletes_a_resource.yml
345
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_get/fetches_resources.yml
346
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_patch/updates_a_resource.yml
347
+ - spec/cassettes/DeskApi_Client/using_Basic_Authentication/_post/creates_a_resource.yml
348
+ - spec/cassettes/DeskApi_Client/using_OAuth/_delete/deletes_a_resource.yml
349
+ - spec/cassettes/DeskApi_Client/using_OAuth/_get/fetches_resources.yml
350
+ - spec/cassettes/DeskApi_Client/using_OAuth/_patch/updates_a_resource.yml
351
+ - spec/cassettes/DeskApi_Client/using_OAuth/_post/creates_a_resource.yml
322
352
  - spec/cassettes/DeskApi_Error/_from_response/can_be_created_from_a_faraday_response.yml
323
353
  - spec/cassettes/DeskApi_Error/_from_response/uses_the_body_message_if_present.yml
324
354
  - spec/cassettes/DeskApi_Resource/_by_url/finds_resources_by_url.yml
data/config.rb DELETED
@@ -1,7 +0,0 @@
1
- module DeskApi
2
- CONFIG = {
3
- username: 'tstachl@salesforce.com',
4
- password: '253e6745',
5
- subdomain: 'devel'
6
- }
7
- end