cs 0.1.0beta3 → 0.1.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.
- checksums.yaml +7 -0
 - data/.travis.yml +8 -0
 - data/Gemfile +22 -6
 - data/README.md +15 -4
 - data/cs.gemspec +7 -7
 - data/lib/{commonsense-ruby-lib.rb → cs.rb} +80 -31
 - data/lib/{commonsense-ruby-lib → cs}/auth/http.rb +52 -33
 - data/lib/{commonsense-ruby-lib → cs}/auth/oauth.rb +28 -28
 - data/lib/cs/collection.rb +7 -0
 - data/lib/cs/collection/sensor_data_collection.rb +61 -0
 - data/lib/{commonsense-ruby-lib → cs}/end_point.rb +36 -24
 - data/lib/cs/end_point/group.rb +26 -0
 - data/lib/cs/end_point/notification.rb +16 -0
 - data/lib/{commonsense-ruby-lib → cs}/end_point/sensor.rb +22 -6
 - data/lib/{commonsense-ruby-lib → cs}/end_point/sensor_data.rb +17 -6
 - data/lib/cs/end_point/trigger.rb +16 -0
 - data/lib/{commonsense-ruby-lib → cs}/end_point/user.rb +8 -4
 - data/lib/{commonsense-ruby-lib → cs}/error.rb +7 -1
 - data/lib/cs/parameter_processor.rb +99 -0
 - data/lib/cs/relation.rb +244 -0
 - data/lib/cs/relation/group_relation.rb +24 -0
 - data/lib/cs/relation/notification_relation.rb +20 -0
 - data/lib/{commonsense-ruby-lib → cs}/relation/sensor_data_relation.rb +7 -52
 - data/lib/{commonsense-ruby-lib → cs}/relation/sensor_relation.rb +28 -55
 - data/lib/cs/relation/trigger_relation.rb +21 -0
 - data/lib/cs/relation/user_relation.rb +20 -0
 - data/lib/{commonsense-ruby-lib → cs}/serializer.rb +1 -1
 - data/lib/cs/session.rb +170 -0
 - data/lib/cs/time.rb +45 -0
 - data/lib/cs/version.rb +3 -0
 - data/spec/features/sensor_management_spec.rb +146 -45
 - data/spec/features/user_management_spec.rb +94 -22
 - data/spec/lib/cs/collection/sensor_data_collection_spec.rb +27 -0
 - data/spec/lib/cs/end_point/group_spec.rb +120 -0
 - data/spec/lib/cs/end_point/sensor_data_spec.rb +110 -0
 - data/spec/lib/{commonsense-ruby-lib → cs}/end_point/sensor_spec.rb +6 -6
 - data/spec/lib/{commonsense-ruby-lib → cs}/end_point/user_spec.rb +14 -7
 - data/spec/lib/{commonsense-ruby-lib → cs}/end_point_spec.rb +25 -12
 - data/spec/lib/cs/relation/group_relation_spec.rb +103 -0
 - data/spec/lib/cs/relation/sensor_data_relation_spec.rb +184 -0
 - data/spec/lib/cs/relation/sensor_relation_spec.rb +192 -0
 - data/spec/lib/cs/relation/user_relation_spec.rb +81 -0
 - data/spec/lib/cs/relation_spec.rb +151 -0
 - data/spec/lib/cs/session_spec.rb +91 -0
 - data/spec/lib/cs/time_spec.rb +71 -0
 - data/spec/lib/cs_spec.rb +85 -0
 - data/spec/spec_helper.rb +6 -26
 - metadata +69 -86
 - data/lib/commonsense-ruby-lib/end_point/group.rb +0 -28
 - data/lib/commonsense-ruby-lib/relation.rb +0 -233
 - data/lib/commonsense-ruby-lib/session.rb +0 -105
 - data/lib/commonsense-ruby-lib/version.rb +0 -3
 - data/spec/lib/commonsense-ruby-lib/end_point/sensor_data_spec.rb +0 -68
 - data/spec/lib/commonsense-ruby-lib/relation/sensor_data_relation_spec.rb +0 -444
 - data/spec/lib/commonsense-ruby-lib/relation/sensor_relation_spec.rb +0 -165
 - data/spec/lib/commonsense-ruby-lib/session_spec.rb +0 -43
 - data/spec/lib/commonsense-ruby-lib_spec.rb +0 -51
 
| 
         @@ -1,165 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'commonsense-ruby-lib/end_point/sensor'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module CommonSense
         
     | 
| 
       5 
     | 
    
         
            -
              module Relation
         
     | 
| 
       6 
     | 
    
         
            -
                describe SensorRelation do
         
     | 
| 
       7 
     | 
    
         
            -
                  describe "build" do
         
     | 
| 
       8 
     | 
    
         
            -
                    it "should return a sensor object" do
         
     | 
| 
       9 
     | 
    
         
            -
                      SensorRelation.new.build.should be_a_kind_of(EndPoint::Sensor)
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
       11 
     | 
    
         
            -
                  end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                  let(:sensors) {
         
     | 
| 
       14 
     | 
    
         
            -
                    {"sensors" => [{"name" => "sensor1"}, {"name" => "sensor2"}, {"name" => "sensor3"}], "total" => 3}
         
     | 
| 
       15 
     | 
    
         
            -
                  }
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  let(:relation) {
         
     | 
| 
       18 
     | 
    
         
            -
                    relation = SensorRelation.new
         
     | 
| 
       19 
     | 
    
         
            -
                    relation.stub("check_session!").and_return(true)
         
     | 
| 
       20 
     | 
    
         
            -
                    relation.stub("get_data!").and_return(sensors)
         
     | 
| 
       21 
     | 
    
         
            -
                    relation
         
     | 
| 
       22 
     | 
    
         
            -
                  }
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  describe "get_data!" do
         
     | 
| 
       25 
     | 
    
         
            -
                    it "should fetch sensor data from commonSense" do
         
     | 
| 
       26 
     | 
    
         
            -
                      session = double('Session')
         
     | 
| 
       27 
     | 
    
         
            -
                      option = {page: 100, per_page: 99, shared: 1, owned:1, physical: 1, details: "full"}
         
     | 
| 
       28 
     | 
    
         
            -
                      session.should_receive(:get).with("/sensors.json", option)
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                      relation = SensorRelation.new(session)
         
     | 
| 
       31 
     | 
    
         
            -
                      relation.get_data!(page: 100, per_page: 99, shared:true, owned:true, physical:true, details:"full")
         
     | 
| 
       32 
     | 
    
         
            -
                    end
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                  describe "get_data" do
         
     | 
| 
       36 
     | 
    
         
            -
                    it "should not throw an exception" do
         
     | 
| 
       37 
     | 
    
         
            -
                      relation = SensorRelation.new
         
     | 
| 
       38 
     | 
    
         
            -
                      relation.stub(:get_data!).and_return { raise Error }
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                      expect { relation.get_data}.to_not raise_error
         
     | 
| 
       41 
     | 
    
         
            -
                    end
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  describe "each" do
         
     | 
| 
       45 
     | 
    
         
            -
                    it "should get all sensor and yield each" do
         
     | 
| 
       46 
     | 
    
         
            -
                      relation = SensorRelation.new
         
     | 
| 
       47 
     | 
    
         
            -
                      relation.stub("get_data").and_return(sensors)
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                      expect { |b| relation.each(&b) }.to yield_successive_args(EndPoint::Sensor, EndPoint::Sensor, EndPoint::Sensor)
         
     | 
| 
       50 
     | 
    
         
            -
                    end
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                  describe "count" do
         
     | 
| 
       54 
     | 
    
         
            -
                    it "should return the total number of record" do
         
     | 
| 
       55 
     | 
    
         
            -
                      relation.count.should eq(3)
         
     | 
| 
       56 
     | 
    
         
            -
                    end
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                  describe "first" do
         
     | 
| 
       60 
     | 
    
         
            -
                    it "should return the first record" do
         
     | 
| 
       61 
     | 
    
         
            -
                      first = relation.first
         
     | 
| 
       62 
     | 
    
         
            -
                      first.should be_kind_of(EndPoint::Sensor)
         
     | 
| 
       63 
     | 
    
         
            -
                      first.name.should eq("sensor1")
         
     | 
| 
       64 
     | 
    
         
            -
                    end
         
     | 
| 
       65 
     | 
    
         
            -
                  end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  describe "last" do
         
     | 
| 
       68 
     | 
    
         
            -
                    it "should return the last record" do
         
     | 
| 
       69 
     | 
    
         
            -
                      relation = SensorRelation.new
         
     | 
| 
       70 
     | 
    
         
            -
                      relation.stub("count").and_return(3)
         
     | 
| 
       71 
     | 
    
         
            -
                      relation.should_receive("get_data").with(page:2, per_page:1, shared:nil, owned:nil, physical:nil, details:nil).and_return({"sensors" => [{"name" => "sensor3"}], "total" => 3})
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                      first = relation.last
         
     | 
| 
       74 
     | 
    
         
            -
                      first.should be_kind_of(EndPoint::Sensor)
         
     | 
| 
       75 
     | 
    
         
            -
                      first.name.should eq("sensor3")
         
     | 
| 
       76 
     | 
    
         
            -
                    end
         
     | 
| 
       77 
     | 
    
         
            -
                  end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                  describe "where" do
         
     | 
| 
       80 
     | 
    
         
            -
                    it "should update the query parameter" do
         
     | 
| 
       81 
     | 
    
         
            -
                      relation = SensorRelation.new
         
     | 
| 
       82 
     | 
    
         
            -
                      relation.where(page:0, per_page:10, shared: true, owned:true, physical: true, details: "full")
         
     | 
| 
       83 
     | 
    
         
            -
                      relation.page.should eq(0)
         
     | 
| 
       84 
     | 
    
         
            -
                      relation.per_page.should eq(10)
         
     | 
| 
       85 
     | 
    
         
            -
                      relation.shared.should eq(1)
         
     | 
| 
       86 
     | 
    
         
            -
                      relation.owned.should eq(1)
         
     | 
| 
       87 
     | 
    
         
            -
                      relation.physical.should eq(1)
         
     | 
| 
       88 
     | 
    
         
            -
                      relation.details.should eq("full")
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                      relation.where(page:0, per_page:10, shared: false, owned:false, physical: false, details: "no")
         
     | 
| 
       91 
     | 
    
         
            -
                      relation.page.should eq(0)
         
     | 
| 
       92 
     | 
    
         
            -
                      relation.per_page.should eq(10)
         
     | 
| 
       93 
     | 
    
         
            -
                      relation.shared.should eq(0)
         
     | 
| 
       94 
     | 
    
         
            -
                      relation.owned.should eq(0)
         
     | 
| 
       95 
     | 
    
         
            -
                      relation.physical.should eq(0)
         
     | 
| 
       96 
     | 
    
         
            -
                      relation.details.should eq("no")
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                      relation.where(page:nil, per_page:nil, shared: nil, owned:nil, physical: nil, details: nil)
         
     | 
| 
       99 
     | 
    
         
            -
                      relation.page.should eq(0)
         
     | 
| 
       100 
     | 
    
         
            -
                      relation.per_page.should eq(1000)
         
     | 
| 
       101 
     | 
    
         
            -
                      relation.shared.should be_nil
         
     | 
| 
       102 
     | 
    
         
            -
                      relation.owned.should be_nil
         
     | 
| 
       103 
     | 
    
         
            -
                      relation.physical.should be_nil
         
     | 
| 
       104 
     | 
    
         
            -
                      relation.details.should be_nil
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
                      relation.page = 100
         
     | 
| 
       107 
     | 
    
         
            -
                      expect { relation.where(page: 'a') }.to raise_error ArgumentError
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                      relation.per_page = 999
         
     | 
| 
       110 
     | 
    
         
            -
                      expect { relation.where(per_page: 'a') }.to raise_error ArgumentError
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                      relation.shared = false
         
     | 
| 
       113 
     | 
    
         
            -
                      relation.where(shared: "true")
         
     | 
| 
       114 
     | 
    
         
            -
                      relation.shared.should be_true
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                      relation.shared = false
         
     | 
| 
       117 
     | 
    
         
            -
                      relation.where(shared: 1)
         
     | 
| 
       118 
     | 
    
         
            -
                      relation.shared.should be_true
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                      relation.shared = true
         
     | 
| 
       121 
     | 
    
         
            -
                      relation.where(shared: 0)
         
     | 
| 
       122 
     | 
    
         
            -
                      relation.shared.should eq(0)
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                      relation.shared = true
         
     | 
| 
       125 
     | 
    
         
            -
                      relation.where(shared: false)
         
     | 
| 
       126 
     | 
    
         
            -
                      relation.shared.should eq(0)
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                      relation.shared = true
         
     | 
| 
       129 
     | 
    
         
            -
                      relation.where(shared: "false")
         
     | 
| 
       130 
     | 
    
         
            -
                      relation.shared.should eq(0)
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                      relation.details = nil
         
     | 
| 
       133 
     | 
    
         
            -
                      relation.where(details: "no")
         
     | 
| 
       134 
     | 
    
         
            -
                      relation.details.should eq("no")
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                      relation.details = nil
         
     | 
| 
       137 
     | 
    
         
            -
                      relation.where(details: "full")
         
     | 
| 
       138 
     | 
    
         
            -
                      relation.details.should eq("full")
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
                      relation.details = nil
         
     | 
| 
       141 
     | 
    
         
            -
                      expect { relation.where(details: 1) }.to raise_error ArgumentError
         
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                      relation.details = nil
         
     | 
| 
       145 
     | 
    
         
            -
                      expect { relation.where(details: false) }.to raise_error ArgumentError
         
     | 
| 
       146 
     | 
    
         
            -
                    end
         
     | 
| 
       147 
     | 
    
         
            -
                  end
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                  describe "find_by_name" do
         
     | 
| 
       150 
     | 
    
         
            -
                    it "should return an array of matching sensor name" do
         
     | 
| 
       151 
     | 
    
         
            -
                      relation = SensorRelation.new
         
     | 
| 
       152 
     | 
    
         
            -
                      relation.session = double('Session')
         
     | 
| 
       153 
     | 
    
         
            -
                      relation.stub("count").and_return(3)
         
     | 
| 
       154 
     | 
    
         
            -
                      relation.should_receive("get_data").with(page:0, per_page:nil, shared:nil, owned:nil, physical:nil, details:nil).and_return({"sensors" => [{"name" => "sensor11"}, {"name" => "sensor12"}, {"name" => "sensor2"}], "total" => 3})
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
                      sensors = relation.find_by_name(/sensor1/)
         
     | 
| 
       157 
     | 
    
         
            -
                      sensors.should be_kind_of(Array)
         
     | 
| 
       158 
     | 
    
         
            -
                      sensors.size.should eq(2)
         
     | 
| 
       159 
     | 
    
         
            -
                      sensors[0].name.should eq("sensor11")
         
     | 
| 
       160 
     | 
    
         
            -
                      sensors[1].name.should eq("sensor12")
         
     | 
| 
       161 
     | 
    
         
            -
                    end
         
     | 
| 
       162 
     | 
    
         
            -
                  end
         
     | 
| 
       163 
     | 
    
         
            -
                end
         
     | 
| 
       164 
     | 
    
         
            -
              end
         
     | 
| 
       165 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,43 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe "session" do
         
     | 
| 
       4 
     | 
    
         
            -
              before(:each) do
         
     | 
| 
       5 
     | 
    
         
            -
                @client = client = CommonSense::Client.new(base_uri: ENV['spec_base_uri'])
         
     | 
| 
       6 
     | 
    
         
            -
              end
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              describe "login" do
         
     | 
| 
       9 
     | 
    
         
            -
                describe "with corrent username and password" do
         
     | 
| 
       10 
     | 
    
         
            -
                  it "should create new session" do
         
     | 
| 
       11 
     | 
    
         
            -
                    session_id = @client.login($user.username, 'password')
         
     | 
| 
       12 
     | 
    
         
            -
                    session_id.should_not be_nil
         
     | 
| 
       13 
     | 
    
         
            -
                    @client.session.should_not be_nil
         
     | 
| 
       14 
     | 
    
         
            -
                    @client.session.response_code.should eq(200)
         
     | 
| 
       15 
     | 
    
         
            -
                    @client.session.session_id.should_not be_nil
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                describe "with incorrect username or password" do
         
     | 
| 
       20 
     | 
    
         
            -
                  it "should create new session", :vcr do
         
     | 
| 
       21 
     | 
    
         
            -
                    session_id = @client.login($user.username, "x#{$user.password}")
         
     | 
| 
       22 
     | 
    
         
            -
                    session_id.should be_nil
         
     | 
| 
       23 
     | 
    
         
            -
                    @client.session.should_not be_nil
         
     | 
| 
       24 
     | 
    
         
            -
                    @client.session.response_code.should eq(403)
         
     | 
| 
       25 
     | 
    
         
            -
                    @client.session.session_id.should be_nil
         
     | 
| 
       26 
     | 
    
         
            -
                  end
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              describe "oauth" do
         
     | 
| 
       31 
     | 
    
         
            -
                describe "with correct access token" do
         
     | 
| 
       32 
     | 
    
         
            -
                   it "should create new session with oauth" do
         
     | 
| 
       33 
     | 
    
         
            -
                     pending
         
     | 
| 
       34 
     | 
    
         
            -
                     session = @client.oauth(CONFIG['CS_CONSUMER_KEY'], CONFIG['CS_CONSUMER_SECRET'],
         
     | 
| 
       35 
     | 
    
         
            -
                                            CONFIG['CS_ACCESS_TOKEN'], CONFIG['CS_ACCESS_TOKEN_SECRET'])
         
     | 
| 
       36 
     | 
    
         
            -
                     session.should be_true
         
     | 
| 
       37 
     | 
    
         
            -
                     @client.current_user.should_not be_nil
         
     | 
| 
       38 
     | 
    
         
            -
                     @client.session.response_code.should eq(200)
         
     | 
| 
       39 
     | 
    
         
            -
                     @client.session.response_body.should_not be_nil
         
     | 
| 
       40 
     | 
    
         
            -
                   end
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,51 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe "commonsense-ruby-lib" do
         
     | 
| 
       4 
     | 
    
         
            -
              describe "client with authentication" do
         
     | 
| 
       5 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       6 
     | 
    
         
            -
                  @client = client = create_client
         
     | 
| 
       7 
     | 
    
         
            -
                  @session_id = @client.login($user.username, 'password')
         
     | 
| 
       8 
     | 
    
         
            -
                  @session_id.should_not be_nil
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                describe "current_user" do
         
     | 
| 
       12 
     | 
    
         
            -
                  it "should return current user information" do
         
     | 
| 
       13 
     | 
    
         
            -
                    current_user = @client.current_user
         
     | 
| 
       14 
     | 
    
         
            -
                    current_user.username.should eq($user.username)
         
     | 
| 
       15 
     | 
    
         
            -
                    current_user.to_h.should be_kind_of Hash
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                describe "groups" do
         
     | 
| 
       20 
     | 
    
         
            -
                  it "should return groups that current user belongs to" do
         
     | 
| 
       21 
     | 
    
         
            -
                    groups = @client.current_groups
         
     | 
| 
       22 
     | 
    
         
            -
                    groups.should be_empty
         
     | 
| 
       23 
     | 
    
         
            -
                  end
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                describe "new_user" do
         
     | 
| 
       27 
     | 
    
         
            -
                  it "should create a new user" do
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                  end
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                describe "sensors" do
         
     | 
| 
       33 
     | 
    
         
            -
                  it "should return Sensors relation" do
         
     | 
| 
       34 
     | 
    
         
            -
                    @client.sensors.should be_a_kind_of(CommonSense::Relation::SensorRelation)
         
     | 
| 
       35 
     | 
    
         
            -
                  end
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
              end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              describe "with session_id" do
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
              describe "with OAuth" do
         
     | 
| 
       43 
     | 
    
         
            -
                before(:each) do
         
     | 
| 
       44 
     | 
    
         
            -
                  @client = client = CommonSense::Client.new
         
     | 
| 
       45 
     | 
    
         
            -
                  @client.oauth(CONFIG['CS_CONSUMER_KEY'], CONFIG['CS_CONSUMER_SECRET'],
         
     | 
| 
       46 
     | 
    
         
            -
                                CONFIG['CS_ACCESS_TOKEN'], CONFIG['CS_ACCESS_TOKEN_SECRET'])
         
     | 
| 
       47 
     | 
    
         
            -
                end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                #it_behaves_like "Client"
         
     | 
| 
       50 
     | 
    
         
            -
              end
         
     | 
| 
       51 
     | 
    
         
            -
            end
         
     |