tumblr_wrapper 0.3.4 → 0.4.0
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/README.md +2 -2
- data/lib/tumblr_wrapper/response.rb +4 -4
- data/lib/tumblr_wrapper/version.rb +1 -1
- data/spec/integration/tumblr_wrapper_spec.rb +2 -5
- metadata +2 -2
data/README.md
CHANGED
|
@@ -79,13 +79,13 @@ To delete a post:
|
|
|
79
79
|
post.delete({id: "ID FROM TUMBLR"})
|
|
80
80
|
|
|
81
81
|
The response object is a TumblrWrapper::Response.
|
|
82
|
-
It responds to `:status`, `:
|
|
82
|
+
It responds to `:status`, `:message`, and any of the keys under "response" from tumblr.
|
|
83
83
|
Any of the values which are hashes will have indifferent access.
|
|
84
84
|
For example,
|
|
85
85
|
|
|
86
86
|
response = blog.posts
|
|
87
87
|
response.status.should == 200
|
|
88
|
-
response.
|
|
88
|
+
response.message.should == "OK"
|
|
89
89
|
response.blog[:title].should == "Your Blog Title"
|
|
90
90
|
response.posts.should be_a(Array)
|
|
91
91
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class TumblrWrapper::Response
|
|
2
|
-
attr_reader :status, :
|
|
2
|
+
attr_reader :status, :message
|
|
3
3
|
def initialize(faraday_response)
|
|
4
4
|
@faraday_response = faraday_response
|
|
5
5
|
@status = faraday_response.status
|
|
6
6
|
@response = faraday_response.body["response"]
|
|
7
|
-
|
|
7
|
+
parse_message
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
private
|
|
@@ -16,9 +16,9 @@ class TumblrWrapper::Response
|
|
|
16
16
|
@response
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def parse_message
|
|
20
20
|
resp = faraday_response.body["meta"] || {}
|
|
21
|
-
@
|
|
21
|
+
@message = resp.respond_to?(:keys) ? resp['msg'] : nil
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def method_missing(meth, *args, &block)
|
|
@@ -37,9 +37,7 @@ describe TumblrWrapper, type: :integration do
|
|
|
37
37
|
response.should be_a(TumblrWrapper::Response)
|
|
38
38
|
response.status.should == 200
|
|
39
39
|
|
|
40
|
-
response.
|
|
41
|
-
response.meta[:status].should == 200
|
|
42
|
-
|
|
40
|
+
response.message.should == "OK"
|
|
43
41
|
response.blog[:title].should == blog_title
|
|
44
42
|
end
|
|
45
43
|
end
|
|
@@ -62,8 +60,7 @@ describe TumblrWrapper, type: :integration do
|
|
|
62
60
|
blog_resource = TumblrWrapper::Blog.new(blogname, token)
|
|
63
61
|
response = blog_resource.posts
|
|
64
62
|
response.status.should == 200
|
|
65
|
-
|
|
66
|
-
response.meta.should be_present
|
|
63
|
+
response.message.should == "OK"
|
|
67
64
|
response.blog.should be_present
|
|
68
65
|
response.posts.should be_present
|
|
69
66
|
end
|