koala 1.10.0 → 1.10.1

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: 8fbf6009ed276428f749b25ebe538d02c4ec0831
4
- data.tar.gz: c8a02ac36b34c9d870aa10e07a9e0a5326b0aa08
3
+ metadata.gz: 8b83335264188054c217fd836a1f6508b2fcf420
4
+ data.tar.gz: 43116e3f574b6c689bed8a6a47a0ff25b69f6f3f
5
5
  SHA512:
6
- metadata.gz: f042c8e2da7bed0161d139ade7563308fc03ef4faf9b05ca728c06ba169db6b92cacf915fed0b532ebde92c8816040d579adc3dc1eeb603c99c77f14575db359
7
- data.tar.gz: 50870365972759818adf1470907f5af7e5592c9431ca12e1947613ee9fd8e40b13a276709c66f5b8b3eae2ba9367f471c5cc2a43aeb7329c80a2889311d1f253
6
+ metadata.gz: 5982606d43ac0435e33de8b1a74e6ed32077cc515f0a52162f2ae5fe043242051e23c49a3502fcfac97ba539b7d6bcf777b383ea3bbc70db0c846d8532c04a7f
7
+ data.tar.gz: abf6a0fbf049448a8d5195e353512307c0dc1d03c319fa3d61448457463ef3e994e14b9dff4b9712b846be47984c88b28225d8aec4a8e4227658807ffafd00a5
@@ -1,3 +1,11 @@
1
+ v.1.10.1
2
+ ========
3
+
4
+ Bug fixes:
5
+
6
+ * Facebook API version now works in all cases (thanks, markprzepiora!)
7
+ * Fixed a typo in an example (thanks, mktakuya!)
8
+
1
9
  v.1.10.0
2
10
  ========
3
11
 
@@ -119,7 +119,7 @@ module Koala
119
119
 
120
120
  # Write an object to the Graph for a specific user.
121
121
  # See {http://developers.facebook.com/docs/api#publishing Facebook's documentation}
122
- # for all the supported writeable objects. It is important to note that objects
122
+ # for all the supported writeable objects. It is important to note that objects
123
123
  # take the singular form, i.e. "event" when using put_connections.
124
124
  #
125
125
  # @note (see #get_connection)
@@ -237,7 +237,7 @@ module Koala
237
237
  #
238
238
  # @example
239
239
  # @api.put_wall_post("Hello there!", {
240
- # "name" => "Link name"
240
+ # "name" => "Link name",
241
241
  # "link" => "http://www.example.com/",
242
242
  # "caption" => "{*actor*} posted a new review",
243
243
  # "description" => "This is a longer description of the attachment",
@@ -47,17 +47,12 @@ module Koala
47
47
  # @option options :video use the server designated for video uploads
48
48
  # @option options :beta use the beta tier
49
49
  # @option options :use_ssl force https, even if not needed
50
- # @option options :api_version a version of the Facebook API, e.g. v2.0
51
50
  #
52
51
  # @return a complete server address with protocol
53
52
  def self.server(options = {})
54
53
  server = "#{options[:rest_api] ? Koala.config.rest_server : Koala.config.graph_server}"
55
54
  server.gsub!(Koala.config.host_path_matcher, Koala.config.video_replace) if options[:video]
56
55
  server.gsub!(Koala.config.host_path_matcher, Koala.config.beta_replace) if options[:beta]
57
- # ...and an API version if specified
58
- if api_version = options[:api_version] || Koala.config.api_version
59
- server = "#{server}/#{api_version}"
60
- end
61
56
  "#{options[:use_ssl] ? "https" : "http"}://#{server}"
62
57
  end
63
58
 
@@ -93,6 +88,13 @@ module Koala
93
88
  ssl[:verify] = true unless ssl.has_key?(:verify)
94
89
  end
95
90
 
91
+ # if an api_version is specified, prepend it to the path
92
+ if api_version = request_options[:api_version] || Koala.config.api_version
93
+ begins_with_slash = path[0] == "/"
94
+ divider = begins_with_slash ? "" : "/"
95
+ path = "/#{api_version}#{divider}#{path}"
96
+ end
97
+
96
98
  # set up our Faraday connection
97
99
  # we have to manually assign params to the URL or the
98
100
  conn = Faraday.new(server(request_options), faraday_options(request_options), &(faraday_middleware || DEFAULT_MIDDLEWARE))
@@ -1,3 +1,3 @@
1
1
  module Koala
2
- VERSION = "1.10.0"
2
+ VERSION = "1.10.1"
3
3
  end
@@ -130,23 +130,6 @@ describe Koala::HTTPService do
130
130
  expect(server).to match(Regexp.new(Koala.config.graph_server.gsub(/\.facebook/, "-video.facebook")))
131
131
  end
132
132
  end
133
-
134
- context "with API versions" do
135
- it "adds a version if specified by Koala.config" do
136
- Koala.config.api_version = "v1000.000"
137
- expect(Koala::HTTPService.server).to eq(
138
- "http://#{Koala.config.graph_server}/#{Koala.config.api_version}"
139
- )
140
- end
141
-
142
- it "prefers a version set in the options" do
143
- Koala.config.api_version = "v1000.000"
144
- version = "v2.0"
145
- expect(Koala::HTTPService.server(api_version: version)).to eq(
146
- "http://#{Koala.config.graph_server}/#{version}"
147
- )
148
- end
149
- end
150
133
  end
151
134
 
152
135
  describe ".encode_params" do
@@ -293,6 +276,28 @@ describe Koala::HTTPService do
293
276
  end
294
277
  end
295
278
 
279
+
280
+ context "with API versions" do
281
+ it "adds a version if specified by Koala.config" do
282
+ expect(Koala.config).to receive(:api_version).and_return("v11")
283
+ expect(@mock_connection).to receive(:get).with("/v11/anything", anything)
284
+ Koala::HTTPService.make_request("anything", {}, "get")
285
+ end
286
+
287
+ it "prefers a version set in http_options" do
288
+ allow(Koala.config).to receive(:api_version).and_return("v11")
289
+ allow(Koala::HTTPService).to receive(:http_options).and_return({ api_version: 'v12' })
290
+ expect(@mock_connection).to receive(:get).with("/v12/anything", anything)
291
+ Koala::HTTPService.make_request("anything", {}, "get")
292
+ end
293
+
294
+ it "doesn't add double slashes to the path" do
295
+ allow(Koala::HTTPService).to receive(:http_options).and_return({ api_version: 'v12' })
296
+ expect(@mock_connection).to receive(:get).with("/v12/anything", anything)
297
+ Koala::HTTPService.make_request("/anything", {}, "get")
298
+ end
299
+ end
300
+
296
301
  it "makes a POST request if the verb isn't get" do
297
302
  expect(@mock_connection).to receive(:post).and_return(@mock_http_response)
298
303
  Koala::HTTPService.make_request("anything", {}, "anything")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koala
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Koppel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-21 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json