one_sky 1.0.0 → 2.0.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/.rspec +2 -0
- data/Gemfile.lock +13 -13
- data/README.rdoc +51 -7
- data/Rakefile +17 -1
- data/lib/one_sky.rb +8 -9
- data/lib/one_sky/client.rb +80 -0
- data/lib/one_sky/platform.rb +36 -0
- data/lib/one_sky/project.rb +22 -114
- data/lib/one_sky/translation.rb +129 -0
- data/lib/one_sky/utility.rb +38 -0
- data/lib/one_sky/version.rb +1 -1
- data/one_sky.gemspec +4 -3
- data/spec/client_spec.rb +172 -0
- data/spec/files/example.po +2 -0
- data/spec/files/example.yml +5 -0
- data/spec/live_spec.rb +187 -0
- data/spec/platform_spec.rb +101 -0
- data/spec/project_spec.rb +67 -48
- data/spec/{helpers.rb → spec_helper.rb} +2 -2
- data/spec/translation_spec.rb +124 -0
- data/spec/utility_spec.rb +98 -0
- metadata +45 -21
- data/spec/data/en-us.po +0 -21
- data/spec/input_spec.rb +0 -64
- data/spec/output_spec.rb +0 -35
| @@ -0,0 +1,101 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe OneSky::Platform do
         | 
| 4 | 
            +
              let(:api_key) { "apikey" }
         | 
| 5 | 
            +
              let(:secret)  { "secret" }
         | 
| 6 | 
            +
              let(:project_name) { "some-project" }
         | 
| 7 | 
            +
              let(:platform_id) { 123 }
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
              let(:client) { OneSky::Client.new(api_key, secret) }
         | 
| 10 | 
            +
              let(:project) { client.project(project_name) }
         | 
| 11 | 
            +
              let(:platform) { project.platform(platform_id) }
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
              describe "proxies" do
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                describe "translation" do
         | 
| 16 | 
            +
                  
         | 
| 17 | 
            +
                  let(:translation) { platform.translation }
         | 
| 18 | 
            +
                  
         | 
| 19 | 
            +
                  it "returns a OneSky::Translation instance" do
         | 
| 20 | 
            +
                    translation.should be_an_instance_of OneSky::Translation
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                  
         | 
| 23 | 
            +
                  it "sets the client to itself" do
         | 
| 24 | 
            +
                    translation.client.should == client
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
                  
         | 
| 27 | 
            +
                  it "sets the same platform_id" do
         | 
| 28 | 
            +
                    translation.platform_id.should == platform_id
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
                
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
              
         | 
| 34 | 
            +
              describe "details" do
         | 
| 35 | 
            +
                
         | 
| 36 | 
            +
                let(:example) do
         | 
| 37 | 
            +
                  # example from the api docs
         | 
| 38 | 
            +
                  # but with the outer key as "platform" (the docs say "project")
         | 
| 39 | 
            +
                  {
         | 
| 40 | 
            +
                      "platform" => {
         | 
| 41 | 
            +
                          "name" => "Website",
         | 
| 42 | 
            +
                          "base_locale" => "en_US",
         | 
| 43 | 
            +
                          "type" => {
         | 
| 44 | 
            +
                              "name" => "iPhone/iPad App",
         | 
| 45 | 
            +
                              "code" => "ios"
         | 
| 46 | 
            +
                          }
         | 
| 47 | 
            +
                      }
         | 
| 48 | 
            +
                  }
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
                
         | 
| 51 | 
            +
                it "calls /platform/details" do
         | 
| 52 | 
            +
                  # example from the api docs
         | 
| 53 | 
            +
                  # but with the outer key as "platform" (the docs say "project")
         | 
| 54 | 
            +
                  client.should_receive(:get).with("platform/details", :"platform-id" => platform_id).and_return(example)
         | 
| 55 | 
            +
                  platform.details.should == example["platform"]
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
              
         | 
| 59 | 
            +
              describe "locales" do
         | 
| 60 | 
            +
                
         | 
| 61 | 
            +
                let(:example) do
         | 
| 62 | 
            +
                  {
         | 
| 63 | 
            +
                      "locales" => [
         | 
| 64 | 
            +
                          {
         | 
| 65 | 
            +
                              "locale" => "en_US",
         | 
| 66 | 
            +
                              "name" => {
         | 
| 67 | 
            +
                              	"eng" => "English (US)",
         | 
| 68 | 
            +
                              	"local" => "English (US)"
         | 
| 69 | 
            +
                              },
         | 
| 70 | 
            +
                              "locale_ios" => "en",
         | 
| 71 | 
            +
                              "is_active" => true,
         | 
| 72 | 
            +
                              "is_private" => false,
         | 
| 73 | 
            +
                              "string_select_threshold" => 3,
         | 
| 74 | 
            +
                              "string_confirm_threshold" => 20,
         | 
| 75 | 
            +
                              "completeness" => 0,
         | 
| 76 | 
            +
                          },
         | 
| 77 | 
            +
                          {
         | 
| 78 | 
            +
                              "locale" => "zh_TW",
         | 
| 79 | 
            +
                              "name" => {
         | 
| 80 | 
            +
                        	      	"eng" => "Traditional Chinese",
         | 
| 81 | 
            +
                              	  "local" => "*some-chinese*"
         | 
| 82 | 
            +
                              },
         | 
| 83 | 
            +
                              "locale_ios" => "zh-Hant",
         | 
| 84 | 
            +
                              "is_active" => true,
         | 
| 85 | 
            +
                              "is_private" => false,
         | 
| 86 | 
            +
                              "string_select_threshold" => 3,
         | 
| 87 | 
            +
                              "string_confirm_threshold" => 20,
         | 
| 88 | 
            +
                              "completeness" => 0,
         | 
| 89 | 
            +
                          },
         | 
| 90 | 
            +
                       ]
         | 
| 91 | 
            +
                  }
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
                
         | 
| 94 | 
            +
                it "calls /platform/locales" do
         | 
| 95 | 
            +
                  # examples from the api docs
         | 
| 96 | 
            +
                  client.should_receive(:get).with("platform/locales", :"platform-id" => platform_id).and_return(example)
         | 
| 97 | 
            +
                  platform.locales.should == example["locales"]
         | 
| 98 | 
            +
                end
         | 
| 99 | 
            +
              end
         | 
| 100 | 
            +
              
         | 
| 101 | 
            +
            end
         | 
    
        data/spec/project_spec.rb
    CHANGED
    
    | @@ -1,58 +1,77 @@ | |
| 1 | 
            -
            require ' | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe  | 
| 4 | 
            -
               | 
| 5 | 
            -
             | 
| 6 | 
            -
               | 
| 7 | 
            -
             | 
| 8 | 
            -
               | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            describe " | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                   | 
| 3 | 
            +
            describe OneSky::Project do
         | 
| 4 | 
            +
              let(:api_key) { "apikey" }
         | 
| 5 | 
            +
              let(:secret)  { "secret" }
         | 
| 6 | 
            +
              let(:project_name) { "some-project" }
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
              let(:client) { OneSky::Client.new(api_key, secret) }
         | 
| 9 | 
            +
              let(:project) { client.project(project_name) }
         | 
| 10 | 
            +
              
         | 
| 11 | 
            +
              describe "proxies" do
         | 
| 12 | 
            +
                
         | 
| 13 | 
            +
                describe "platform" do
         | 
| 14 | 
            +
                  
         | 
| 15 | 
            +
                  let(:platform_id) { 123 }
         | 
| 16 | 
            +
                  let(:platform) { project.platform(platform_id) }
         | 
| 17 | 
            +
                  
         | 
| 18 | 
            +
                  it "returns a OneSky::Platform instance" do
         | 
| 19 | 
            +
                    platform.should be_an_instance_of OneSky::Platform
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                  
         | 
| 22 | 
            +
                  it "sets the client to itself" do
         | 
| 23 | 
            +
                    platform.client.should == client
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
                  
         | 
| 26 | 
            +
                  it "sets the provided platform_id" do
         | 
| 27 | 
            +
                    platform.platform_id.should == platform_id
         | 
| 28 | 
            +
                  end
         | 
| 26 29 | 
             
                end
         | 
| 30 | 
            +
                
         | 
| 27 31 | 
             
              end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              describe " | 
| 30 | 
            -
                 | 
| 31 | 
            -
             | 
| 32 | 
            -
                   | 
| 33 | 
            -
             | 
| 32 | 
            +
              
         | 
| 33 | 
            +
              describe "platforms" do
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                let(:example) do
         | 
| 36 | 
            +
                  {
         | 
| 37 | 
            +
                      "platforms" => [
         | 
| 38 | 
            +
                          {
         | 
| 39 | 
            +
                              "id" => 1,
         | 
| 40 | 
            +
                              "type" => "iPhone/iPad App",
         | 
| 41 | 
            +
                              "code" => "ios"
         | 
| 42 | 
            +
                          },
         | 
| 43 | 
            +
                          {
         | 
| 44 | 
            +
                              "id" => 2,
         | 
| 45 | 
            +
                              "type" => "Miscelleneous",
         | 
| 46 | 
            +
                              "code" => "misc",
         | 
| 47 | 
            +
                              "description" => "database"
         | 
| 48 | 
            +
                          }
         | 
| 49 | 
            +
                      ]
         | 
| 50 | 
            +
                  }
         | 
| 34 51 | 
             
                end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                   | 
| 40 | 
            -
                  langs.should be_an(Array)
         | 
| 41 | 
            -
                  langs.size.should > 0
         | 
| 52 | 
            +
                
         | 
| 53 | 
            +
                it "calls /project/platforms" do
         | 
| 54 | 
            +
                  # examples from the api docs
         | 
| 55 | 
            +
                  client.should_receive(:get).with("project/platforms", :project => project_name).and_return(example)
         | 
| 56 | 
            +
                  project.platforms.should == example["platforms"]
         | 
| 42 57 | 
             
                end
         | 
| 43 58 | 
             
              end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
              describe " | 
| 46 | 
            -
                 | 
| 47 | 
            -
             | 
| 48 | 
            -
                   | 
| 49 | 
            -
             | 
| 59 | 
            +
              
         | 
| 60 | 
            +
              describe "details" do
         | 
| 61 | 
            +
                
         | 
| 62 | 
            +
                let(:example) do
         | 
| 63 | 
            +
                  {
         | 
| 64 | 
            +
                      "project" => {
         | 
| 65 | 
            +
                          "name" => "Website",
         | 
| 66 | 
            +
                          "base_locale" => "en_US"
         | 
| 67 | 
            +
                      }
         | 
| 68 | 
            +
                  }
         | 
| 50 69 | 
             
                end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
                  @project.get_sso_link("rspec_process").should match /^http.*$/
         | 
| 70 | 
            +
                
         | 
| 71 | 
            +
                it "calls /project/details" do
         | 
| 72 | 
            +
                  client.should_receive(:get).with("project/details", :project => project_name).and_return(example)
         | 
| 73 | 
            +
                  project.details.should == example["project"]
         | 
| 56 74 | 
             
                end
         | 
| 57 75 | 
             
              end
         | 
| 76 | 
            +
              
         | 
| 58 77 | 
             
            end
         | 
| @@ -0,0 +1,124 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe OneSky::Translation do
         | 
| 4 | 
            +
              let(:api_key) { "apikey" }
         | 
| 5 | 
            +
              let(:secret)  { "secret" }
         | 
| 6 | 
            +
              let(:project_name) { "some-project" }
         | 
| 7 | 
            +
              let(:platform_id) { 123 }
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
              let(:client) { OneSky::Client.new(api_key, secret) }
         | 
| 10 | 
            +
              let(:project) { client.project(project_name) }
         | 
| 11 | 
            +
              let(:platform) { project.platform(platform_id) }
         | 
| 12 | 
            +
              let(:translation) { platform.translation }
         | 
| 13 | 
            +
              
         | 
| 14 | 
            +
              describe "input_strings" do
         | 
| 15 | 
            +
                
         | 
| 16 | 
            +
                let(:string_array) {
         | 
| 17 | 
            +
                  ["test1", "test2"]
         | 
| 18 | 
            +
                }
         | 
| 19 | 
            +
                
         | 
| 20 | 
            +
                let(:hash_array) {
         | 
| 21 | 
            +
                  [{:string => "test1"}, {:string => "test2"}]
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                context "with an array of strings" do
         | 
| 25 | 
            +
                  it "calls /string/input" do
         | 
| 26 | 
            +
                    client.should_receive(:post).with("string/input", :input => JSON.dump(hash_array), :"platform-id" => platform_id)
         | 
| 27 | 
            +
                    
         | 
| 28 | 
            +
                    translation.input_strings(string_array)
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
                
         | 
| 32 | 
            +
                context "with an array of hashes" do
         | 
| 33 | 
            +
                  it "calls /string/input" do
         | 
| 34 | 
            +
                    client.should_receive(:post).with("string/input", :input => JSON.dump(hash_array), :"platform-id" => platform_id)
         | 
| 35 | 
            +
                    
         | 
| 36 | 
            +
                    translation.input_strings(hash_array)
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
                
         | 
| 40 | 
            +
                context "with a complex array of hashes" do
         | 
| 41 | 
            +
                  it "dasherizes the keys" do
         | 
| 42 | 
            +
                    original = [{:string => "Test 1", :string_key => "test1"}]
         | 
| 43 | 
            +
                    dasherized = [{:string => "Test 1", :"string-key" => "test1"}]
         | 
| 44 | 
            +
                    
         | 
| 45 | 
            +
                    client.should_receive(:post).with("string/input", :input => JSON.dump(dasherized), :"platform-id" => platform_id)
         | 
| 46 | 
            +
                    
         | 
| 47 | 
            +
                    translation.input_strings(original)
         | 
| 48 | 
            +
                   end
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
              
         | 
| 52 | 
            +
              describe "input_string" do
         | 
| 53 | 
            +
                it "defers to input_strings" do
         | 
| 54 | 
            +
                  translation.should_receive(:input_strings).with(["test1"])
         | 
| 55 | 
            +
                  translation.input_string("test1")
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
              
         | 
| 59 | 
            +
              describe "input_phrases" do
         | 
| 60 | 
            +
                it "defers to input_strings" do
         | 
| 61 | 
            +
                  translation.should_receive(:input_strings).with([{:string_key => "test1", :string => "Test 1"}])
         | 
| 62 | 
            +
                  translation.input_phrases("test1" => "Test 1")
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
              
         | 
| 66 | 
            +
              describe "translate" do
         | 
| 67 | 
            +
                
         | 
| 68 | 
            +
                let(:string_key) { "test1" }
         | 
| 69 | 
            +
                let(:locale) { "en_US" }
         | 
| 70 | 
            +
                let(:string) { "Test 1" }
         | 
| 71 | 
            +
                
         | 
| 72 | 
            +
                it "calls /string/translate" do
         | 
| 73 | 
            +
                  client.should_receive(:post).with(
         | 
| 74 | 
            +
                    "string/translate",
         | 
| 75 | 
            +
                    :"string-key" => string_key,
         | 
| 76 | 
            +
                    :locale => locale,
         | 
| 77 | 
            +
                    :translation => string,
         | 
| 78 | 
            +
                    :"platform-id" => platform_id
         | 
| 79 | 
            +
                  )
         | 
| 80 | 
            +
                  
         | 
| 81 | 
            +
                  translation.translate(string_key, locale, string)
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
              end
         | 
| 84 | 
            +
              
         | 
| 85 | 
            +
              describe "output" do
         | 
| 86 | 
            +
                
         | 
| 87 | 
            +
                let(:example) do
         | 
| 88 | 
            +
                  {
         | 
| 89 | 
            +
                      "translation" => {
         | 
| 90 | 
            +
                          "Tag A" => {
         | 
| 91 | 
            +
                              "Locale A" => {
         | 
| 92 | 
            +
                                  "String Key A" => "string",
         | 
| 93 | 
            +
                                  "String Key B" => {
         | 
| 94 | 
            +
                                      "Context A" => "string",
         | 
| 95 | 
            +
                                      "Context B" => "string"
         | 
| 96 | 
            +
                      	        }
         | 
| 97 | 
            +
                              },
         | 
| 98 | 
            +
                              "Locale B" => {
         | 
| 99 | 
            +
                                  "String Key A" => "string"
         | 
| 100 | 
            +
                              }
         | 
| 101 | 
            +
                          },
         | 
| 102 | 
            +
                          "Tag B" => {
         | 
| 103 | 
            +
                              "Locale A" => {
         | 
| 104 | 
            +
                                  "String Key C" => "string"
         | 
| 105 | 
            +
                              }
         | 
| 106 | 
            +
                          }
         | 
| 107 | 
            +
                      },
         | 
| 108 | 
            +
                      "md5" => "95e6198f16ea363291dfa9bc18282545"
         | 
| 109 | 
            +
                  }
         | 
| 110 | 
            +
                end
         | 
| 111 | 
            +
                
         | 
| 112 | 
            +
                it "calls /string/output" do
         | 
| 113 | 
            +
                  client.should_receive(:get).with("string/output", :"platform-id" => platform_id).and_return(example)
         | 
| 114 | 
            +
                  translation.output.should == example["translation"]
         | 
| 115 | 
            +
                end
         | 
| 116 | 
            +
                
         | 
| 117 | 
            +
                context "for_locale" do
         | 
| 118 | 
            +
                  it "calls /string/output with the locale" do
         | 
| 119 | 
            +
                    client.should_receive(:get).with("string/output", :"platform-id" => platform_id, :locale => "en_US").and_return(example)
         | 
| 120 | 
            +
                    translation.output_for_locale("en_US").should == example["translation"]
         | 
| 121 | 
            +
                  end
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
              end
         | 
| 124 | 
            +
            end
         | 
| @@ -0,0 +1,98 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe OneSky::Utility do
         | 
| 4 | 
            +
              let(:api_key) { "apikey" }
         | 
| 5 | 
            +
              let(:secret)  { "secret" }
         | 
| 6 | 
            +
              
         | 
| 7 | 
            +
              let(:client) { OneSky::Client.new(api_key, secret) }
         | 
| 8 | 
            +
              let(:utility) { client.utility }
         | 
| 9 | 
            +
              
         | 
| 10 | 
            +
              
         | 
| 11 | 
            +
              describe "locales" do
         | 
| 12 | 
            +
                
         | 
| 13 | 
            +
                let(:example) do
         | 
| 14 | 
            +
                  # example from the api docs
         | 
| 15 | 
            +
                  {
         | 
| 16 | 
            +
                      "locales" => [
         | 
| 17 | 
            +
                          {
         | 
| 18 | 
            +
                              "locale" => "en_US",
         | 
| 19 | 
            +
                              "name" => {
         | 
| 20 | 
            +
                                  "eng" => "English (US)",
         | 
| 21 | 
            +
                                  "local" => "English (US)"
         | 
| 22 | 
            +
                              },
         | 
| 23 | 
            +
                              "locale_ios" => "en"
         | 
| 24 | 
            +
                          },
         | 
| 25 | 
            +
                          {
         | 
| 26 | 
            +
                              "locale" => "af_ZA",
         | 
| 27 | 
            +
                              "name" => {
         | 
| 28 | 
            +
                                  "eng" => "Afrikaans",
         | 
| 29 | 
            +
                                  "local" => "Afrikaans"
         | 
| 30 | 
            +
                              }
         | 
| 31 | 
            +
                          },
         | 
| 32 | 
            +
                          {
         | 
| 33 | 
            +
                              "locale" => "sq_AL",
         | 
| 34 | 
            +
                              "name" => {
         | 
| 35 | 
            +
                                  "eng" => "Albanian",
         | 
| 36 | 
            +
                                  "local" => "Shqip"
         | 
| 37 | 
            +
                              }
         | 
| 38 | 
            +
                          }
         | 
| 39 | 
            +
                      ]
         | 
| 40 | 
            +
                  }
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
                
         | 
| 43 | 
            +
                it "calls /locales" do
         | 
| 44 | 
            +
                  client.should_receive(:get).with("locales").and_return(example)
         | 
| 45 | 
            +
                  utility.locales.should == example["locales"]
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
              
         | 
| 49 | 
            +
              describe "platform_types" do
         | 
| 50 | 
            +
                
         | 
| 51 | 
            +
                let(:example) do
         | 
| 52 | 
            +
                  {
         | 
| 53 | 
            +
                      "types" => [
         | 
| 54 | 
            +
                          {
         | 
| 55 | 
            +
                              "name" => "iPhone/iPad App",
         | 
| 56 | 
            +
                              "code" => "ios"
         | 
| 57 | 
            +
                          },
         | 
| 58 | 
            +
                          {
         | 
| 59 | 
            +
                              "name" => "Android App",
         | 
| 60 | 
            +
                              "code" => "android"
         | 
| 61 | 
            +
                          },
         | 
| 62 | 
            +
                          {
         | 
| 63 | 
            +
                              "name" => "Website",
         | 
| 64 | 
            +
                              "code" => "website"
         | 
| 65 | 
            +
                          },
         | 
| 66 | 
            +
                          {
         | 
| 67 | 
            +
                              "name" => "Miscellaneous",
         | 
| 68 | 
            +
                              "code" => "misc"
         | 
| 69 | 
            +
                          }
         | 
| 70 | 
            +
                      ]
         | 
| 71 | 
            +
                  }
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
                
         | 
| 74 | 
            +
                it "calls /platform-types" do
         | 
| 75 | 
            +
                  client.should_receive(:get).with("platform-types").and_return(example)
         | 
| 76 | 
            +
                  utility.platform_types.should == example["types"]
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
              end
         | 
| 79 | 
            +
              
         | 
| 80 | 
            +
              describe "get_sso_link" do
         | 
| 81 | 
            +
                
         | 
| 82 | 
            +
                let(:unique_id) { "abc123" }
         | 
| 83 | 
            +
                let(:name) { "fred" }
         | 
| 84 | 
            +
                
         | 
| 85 | 
            +
                let(:example) do
         | 
| 86 | 
            +
                  {
         | 
| 87 | 
            +
                      "url" => "http:\/\/global.oneskyapp.com\/?time=1290495566&id=abc@oneskyapp.com&data=d98e3fc22ba4bce8537bfef7929f1fc5&name=Leon",
         | 
| 88 | 
            +
                      "md5" => "7f4d51e53b0e2fec49262840caa29720"
         | 
| 89 | 
            +
                  }
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
                
         | 
| 92 | 
            +
                it "calls /sso/get-link" do
         | 
| 93 | 
            +
                  client.should_receive(:post).with("sso/get-link", :"unique-id" => unique_id, :name => name).and_return(example)
         | 
| 94 | 
            +
                  utility.get_sso_link(unique_id, name).should == example["url"]
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
              end
         | 
| 97 | 
            +
              
         | 
| 98 | 
            +
            end
         |