amara 0.0.1 → 0.0.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: 39b648a9d9d4ec8b3d696a4e3a74e3d299a4ad6e
4
- data.tar.gz: 29c2865c646fdd2614d652c9cd53c8f24b2b07ad
3
+ metadata.gz: 7596fc5964396ba836a4a4cda6a466c228ba8d0f
4
+ data.tar.gz: 10376cc8986eeea646c7c22bf0bb9d06487316ac
5
5
  SHA512:
6
- metadata.gz: 6dd1b533b9c6eae14e2eeb194b01be2b3594b2c9d51c2f7e4d3e178901029b982b4d4f3df93c840f32ea50fbc4bff4637ee5b1db117b358a3504e9a58532d475
7
- data.tar.gz: 81a23ab2d4a75b472a3ada63f86c25bb61306da07af21fafd852a393a506037b9179b1ff9fab038f6ab3c69759d1f7cbeb1639f470f3cbafa5d6e1065deb70d7
6
+ metadata.gz: c7fbe2bcbf185039429c1b7d763bd118367faad6c6cc98f3ff1b55bea0b4a9c36dba6f9a7b22cd9c85f4df4ba62468c36d1faf47f97a81ce451b8a30ae3af413
7
+ data.tar.gz: dddf4b661e45472565d4316fe8f920161a4592c6976e6fbe89984cd76ac24aa71f85e5753bbb6dd8de82d18fbbe87b7ae2cc41dda2e31b7848579d7867808d78
@@ -54,8 +54,8 @@ module Amara
54
54
  def base_path
55
55
  parts = self.class.name.split("::").inject([]){|a, c|
56
56
  if c != 'Amara'
57
- base = c.downcase.underscore
58
- a << base
57
+ base = c.underscore
58
+ a << base.tr('_','-')
59
59
  a << current_options["#{base.singularize}_id"] if current_options["#{base.singularize}_id"]
60
60
  end
61
61
  a
@@ -7,9 +7,9 @@ module Amara
7
7
  @teams ||= ApiFactory.api('Amara::Teams', self, params, &block)
8
8
  end
9
9
 
10
- # def videos(params={}, &block)
11
- # @videos ||= Videos.new(current_options.merge(args_to_options(params)), &block)
12
- # end
10
+ def videos(params={}, &block)
11
+ @videos ||= ApiFactory.api('Amara::Videos', self, params, &block)
12
+ end
13
13
 
14
14
  def languages(params={}, &block)
15
15
  @languages ||= ApiFactory.api('Amara::Languages', self, params, &block)
@@ -15,22 +15,25 @@ module Amara
15
15
 
16
16
  def merge_default_options(opts={})
17
17
  headers = opts.delete(:headers) || {}
18
- options = {
19
- :headers => {
20
- 'User-Agent' => user_agent,
21
- 'Accept' => "application/json",
22
- 'Content-Type' => "application/json"
23
- },
24
- :ssl => {:verify => false},
25
- :url => endpoint
26
- }.merge(opts)
18
+ options = HashWithIndifferentAccess.new(
19
+ {
20
+ :headers => {
21
+ 'User-Agent' => user_agent,
22
+ 'Accept' => "application/json",
23
+ 'Content-Type' => "application/json"
24
+ },
25
+ :ssl => {:verify => false},
26
+ :url => endpoint
27
+ }
28
+ ).merge(opts)
27
29
  options[:headers] = options[:headers].merge(headers)
28
- Amara::HEADERS.each{|k,v| options[:headers][v] = options.delete(k) if options.key?(k)}
30
+ Amara::HEADERS.each{|k,v| options[:headers][v] = options.delete(k) if options.key?(k)}
29
31
  options
30
32
  end
31
33
 
32
34
  def connection(options={})
33
35
  opts = merge_default_options(options)
36
+ # puts "connection:\n\toptions: #{options.inspect}\n\topts: #{opts.inspect}"
34
37
  Faraday::Connection.new(opts) do |connection|
35
38
  connection.request :url_encoded
36
39
 
@@ -3,12 +3,16 @@
3
3
  module Amara
4
4
  class Teams < API
5
5
 
6
- def members(options={}, &block)
7
- @members ||= Teams::Members.new(current_options.merge(args_to_options(options)), &block)
6
+ def members(params={}, &block)
7
+ @members ||= ApiFactory.api('Amara::Teams::Members', self, params, &block)
8
8
  end
9
9
 
10
- def projects(options={}, &block)
11
- @projects ||= Teams::Projects.new(current_options.merge(args_to_options(options)), &block)
10
+ def projects(params={}, &block)
11
+ @projects ||= ApiFactory.api('Amara::Teams::Projects', self, params, &block)
12
+ end
13
+
14
+ def safe_members(params={}, &block)
15
+ @safe_members ||= ApiFactory.api('Amara::Teams::SafeMembers', self, params, &block)
12
16
  end
13
17
 
14
18
  end
@@ -0,0 +1,6 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module Amara
4
+ class Teams::SafeMembers < API
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module Amara
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -9,11 +9,11 @@ module Amara
9
9
  VIDEO_ORDERING = [:created, :title]
10
10
 
11
11
  def languages(options={}, &block)
12
- @languages ||= Videos::Languages.new(current_options.merge(args_to_options(options)), &block)
12
+ @languages ||= ApiFactory.api('Amara::Videos::Languages', self, params, &block)
13
13
  end
14
14
 
15
15
  def urls(options={}, &block)
16
- @urls ||= Videos::Urls.new(current_options.merge(args_to_options(options)), &block)
16
+ @urls ||= ApiFactory.api('Amara::Videos::Urls', self, params, &block)
17
17
  end
18
18
 
19
19
  end
@@ -4,7 +4,7 @@ module Amara
4
4
  class Videos::Languages < API
5
5
 
6
6
  def subtitles(options={}, &block)
7
- @subtitles ||= Videos::Languages::Subtitles.new(current_options.merge(args_to_options(options)), &block)
7
+ @subtitles ||= ApiFactory.api('Amara::Videos::Languages::Subtitles', self, params, &block)
8
8
  end
9
9
 
10
10
  end
@@ -9,4 +9,14 @@ describe Amara::Client do
9
9
  amara.teams.wont_be_nil
10
10
  end
11
11
 
12
+ it "returns a videos api object" do
13
+ amara = Amara::Client.new
14
+ amara.videos.wont_be_nil
15
+ end
16
+
17
+ it "returns a languages api object" do
18
+ amara = Amara::Client.new
19
+ amara.languages.wont_be_nil
20
+ end
21
+
12
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kuklewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-12 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -161,6 +161,7 @@ files:
161
161
  - lib/amara/teams.rb
162
162
  - lib/amara/teams/members.rb
163
163
  - lib/amara/teams/projects.rb
164
+ - lib/amara/teams/safe_members.rb
164
165
  - lib/amara/version.rb
165
166
  - lib/amara/videos.rb
166
167
  - lib/amara/videos/languages.rb