tripletexer 0.1.2 → 0.2.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 +4 -4
- data/README.md +6 -1
- data/lib/tripletexer.rb +23 -28
- data/lib/tripletexer/api_client.rb +95 -0
- data/lib/tripletexer/endpoints/abstract_endpoint.rb +12 -62
- data/lib/tripletexer/endpoints/customer.rb +1 -1
- data/lib/tripletexer/endpoints/employee.rb +1 -1
- data/lib/tripletexer/endpoints/invoice.rb +4 -4
- data/lib/tripletexer/endpoints/ledger.rb +10 -10
- data/lib/tripletexer/endpoints/ledger/close_group.rb +2 -2
- data/lib/tripletexer/endpoints/ledger/posting.rb +2 -2
- data/lib/tripletexer/endpoints/ledger/voucher.rb +2 -2
- data/lib/tripletexer/endpoints/order.rb +5 -5
- data/lib/tripletexer/endpoints/project.rb +1 -1
- data/lib/tripletexer/endpoints/timesheet.rb +2 -2
- data/lib/tripletexer/endpoints/timesheet/entry.rb +2 -2
- data/lib/tripletexer/endpoints/timesheet/time_clock.rb +2 -2
- data/lib/tripletexer/endpoints/token.rb +2 -2
- data/lib/tripletexer/endpoints/token/session.rb +7 -7
- data/lib/tripletexer/format_helpers.rb +8 -5
- data/lib/tripletexer/version.rb +1 -1
- data/spec/client_spec.rb +56 -0
- data/spec/endpoints/order_spec.rb +50 -0
- data/spec/endpoints/timesheet_spec.rb +19 -0
- data/spec/endpoints/token/session_spec.rb +33 -0
- data/spec/endpoints/token_spec.rb +19 -0
- data/spec/format_helpers_spec.rb +55 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/tripletexer_spec.rb +114 -0
- data/spec/vcr_cassettes/endpoints/order/find.yml +116 -0
- data/spec/vcr_cassettes/endpoints/order/find__unauthorized.yml +71 -0
- data/spec/vcr_cassettes/endpoints/order/search.yml +164 -0
- data/spec/vcr_cassettes/endpoints/token/session/create.yml +77 -0
- data/spec/vcr_cassettes/endpoints/token/session/destroy.yml +295 -0
- data/spec/vcr_cassettes/endpoints/token/session/whoami.yml +68 -0
- data/spec/web_helper.rb +20 -0
- metadata +162 -16
- data/lib/tripletexer/connection.rb +0 -49
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: put
         | 
| 5 | 
            +
                uri: https://tripletex.no/v2/token/session/:create?consumerToken=<%= ENV['CONSUMER_SECRET'] %>&employeeToken=<%= ENV['EMPLOYEE_TOKEN'] %>&expirationDate=<%= (Time.now.utc.to_date + 1).to_date.to_s %>
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  User-Agent:
         | 
| 13 | 
            +
                  - Faraday v0.13.1
         | 
| 14 | 
            +
                  Content-Length:
         | 
| 15 | 
            +
                  - '0'
         | 
| 16 | 
            +
                  Accept-Encoding:
         | 
| 17 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 18 | 
            +
                  Accept:
         | 
| 19 | 
            +
                  - "*/*"
         | 
| 20 | 
            +
              response:
         | 
| 21 | 
            +
                status:
         | 
| 22 | 
            +
                  code: 200
         | 
| 23 | 
            +
                  message: OK
         | 
| 24 | 
            +
                headers:
         | 
| 25 | 
            +
                  X-Frame-Options:
         | 
| 26 | 
            +
                  - SAMEORIGIN
         | 
| 27 | 
            +
                  Frame-Options:
         | 
| 28 | 
            +
                  - SAMEORIGIN
         | 
| 29 | 
            +
                  Strict-Transport-Security:
         | 
| 30 | 
            +
                  - max-age=31536000
         | 
| 31 | 
            +
                  X-Xss-Protection:
         | 
| 32 | 
            +
                  - 1; mode=block
         | 
| 33 | 
            +
                  X-Content-Type-Options:
         | 
| 34 | 
            +
                  - nosniff
         | 
| 35 | 
            +
                  Cache-Control:
         | 
| 36 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 37 | 
            +
                  - post-check=0, pre-check=0
         | 
| 38 | 
            +
                  Pragma:
         | 
| 39 | 
            +
                  - no-cache
         | 
| 40 | 
            +
                  X-Rate-Limit-Limit:
         | 
| 41 | 
            +
                  - '100'
         | 
| 42 | 
            +
                  X-Rate-Limit-Remaining:
         | 
| 43 | 
            +
                  - '99'
         | 
| 44 | 
            +
                  X-Rate-Limit-Reset:
         | 
| 45 | 
            +
                  - '7'
         | 
| 46 | 
            +
                  Content-Type:
         | 
| 47 | 
            +
                  - application/json;charset=UTF-8
         | 
| 48 | 
            +
                  Content-Length:
         | 
| 49 | 
            +
                  - '429'
         | 
| 50 | 
            +
                  Date:
         | 
| 51 | 
            +
                  - Wed, 27 Sep 2018 17:48:32 GMT
         | 
| 52 | 
            +
                  Server:
         | 
| 53 | 
            +
                  - tripletex.no
         | 
| 54 | 
            +
                body:
         | 
| 55 | 
            +
                  encoding: UTF-8
         | 
| 56 | 
            +
                  string: |-
         | 
| 57 | 
            +
                    {
         | 
| 58 | 
            +
                      "value" : {
         | 
| 59 | 
            +
                        "id" : 12981,
         | 
| 60 | 
            +
                        "version" : 0,
         | 
| 61 | 
            +
                        "url" : "tripletex.no/v2/token/session/12981",
         | 
| 62 | 
            +
                        "consumerToken" : {
         | 
| 63 | 
            +
                          "id" : 3135,
         | 
| 64 | 
            +
                          "url" : "tripletex.no/v2/token/consumer/3135"
         | 
| 65 | 
            +
                        },
         | 
| 66 | 
            +
                        "employeeToken" : {
         | 
| 67 | 
            +
                          "id" : 603,
         | 
| 68 | 
            +
                          "url" : "tripletex.no/v2/token/employee/603"
         | 
| 69 | 
            +
                        },
         | 
| 70 | 
            +
                        "expirationDate" : "<%= (Time.now.utc.to_date + 1).to_date.to_s %>",
         | 
| 71 | 
            +
                        "token" : "<%= ENV['SESSION_TOKEN'] %>",
         | 
| 72 | 
            +
                        "encryptionKey" : null
         | 
| 73 | 
            +
                      }
         | 
| 74 | 
            +
                    }
         | 
| 75 | 
            +
                http_version: 
         | 
| 76 | 
            +
              recorded_at: Wed, 27 Sep 2017 17:48:33 GMT
         | 
| 77 | 
            +
            recorded_with: VCR 3.0.3
         | 
| @@ -0,0 +1,295 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: get
         | 
| 5 | 
            +
                uri: https://tripletex.no/v2/token/session/%3EwhoAmI
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: US-ASCII
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  User-Agent:
         | 
| 13 | 
            +
                  - Faraday v0.13.1
         | 
| 14 | 
            +
                  Accept-Encoding:
         | 
| 15 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 16 | 
            +
                  Accept:
         | 
| 17 | 
            +
                  - "*/*"
         | 
| 18 | 
            +
              response:
         | 
| 19 | 
            +
                status:
         | 
| 20 | 
            +
                  code: 401
         | 
| 21 | 
            +
                  message: Unauthorized
         | 
| 22 | 
            +
                headers:
         | 
| 23 | 
            +
                  X-Frame-Options:
         | 
| 24 | 
            +
                  - SAMEORIGIN
         | 
| 25 | 
            +
                  Frame-Options:
         | 
| 26 | 
            +
                  - SAMEORIGIN
         | 
| 27 | 
            +
                  Strict-Transport-Security:
         | 
| 28 | 
            +
                  - max-age=31536000
         | 
| 29 | 
            +
                  X-Xss-Protection:
         | 
| 30 | 
            +
                  - 1; mode=block
         | 
| 31 | 
            +
                  X-Content-Type-Options:
         | 
| 32 | 
            +
                  - nosniff
         | 
| 33 | 
            +
                  Cache-Control:
         | 
| 34 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 35 | 
            +
                  - post-check=0, pre-check=0
         | 
| 36 | 
            +
                  Pragma:
         | 
| 37 | 
            +
                  - no-cache
         | 
| 38 | 
            +
                  Content-Type:
         | 
| 39 | 
            +
                  - application/json;charset=ISO-8859-1
         | 
| 40 | 
            +
                  Content-Length:
         | 
| 41 | 
            +
                  - '216'
         | 
| 42 | 
            +
                  Date:
         | 
| 43 | 
            +
                  - Wed, 27 Sep 2017 18:21:56 GMT
         | 
| 44 | 
            +
                  Server:
         | 
| 45 | 
            +
                  - tripletex.no
         | 
| 46 | 
            +
                body:
         | 
| 47 | 
            +
                  encoding: UTF-8
         | 
| 48 | 
            +
                  string: '{"status":401,"code":3000,"message":"Unauthorized","link":null,"developerMessage":"Could
         | 
| 49 | 
            +
                    not log in. The Authorization header is missing.","validationMessages":null,"requestId":"d1d34bba-467b-4ba1-b223-a46ac4cd46b4"}'
         | 
| 50 | 
            +
                http_version: 
         | 
| 51 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:21:57 GMT
         | 
| 52 | 
            +
            - request:
         | 
| 53 | 
            +
                method: put
         | 
| 54 | 
            +
                uri: https://tripletex.no/v2/token/session/:create?consumerToken=<%= ENV['CONSUMER_SECRET'] %>&employeeToken=<%= ENV['EMPLOYEE_TOKEN'] %>&expirationDate=<%= (Time.now.utc.to_date + 1).to_s %>
         | 
| 55 | 
            +
                body:
         | 
| 56 | 
            +
                  encoding: UTF-8
         | 
| 57 | 
            +
                  string: ''
         | 
| 58 | 
            +
                headers:
         | 
| 59 | 
            +
                  Content-Type:
         | 
| 60 | 
            +
                  - application/json
         | 
| 61 | 
            +
                  User-Agent:
         | 
| 62 | 
            +
                  - Faraday v0.13.1
         | 
| 63 | 
            +
                  Content-Length:
         | 
| 64 | 
            +
                  - '0'
         | 
| 65 | 
            +
                  Accept-Encoding:
         | 
| 66 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 67 | 
            +
                  Accept:
         | 
| 68 | 
            +
                  - "*/*"
         | 
| 69 | 
            +
              response:
         | 
| 70 | 
            +
                status:
         | 
| 71 | 
            +
                  code: 200
         | 
| 72 | 
            +
                  message: OK
         | 
| 73 | 
            +
                headers:
         | 
| 74 | 
            +
                  X-Frame-Options:
         | 
| 75 | 
            +
                  - SAMEORIGIN
         | 
| 76 | 
            +
                  Frame-Options:
         | 
| 77 | 
            +
                  - SAMEORIGIN
         | 
| 78 | 
            +
                  Strict-Transport-Security:
         | 
| 79 | 
            +
                  - max-age=31536000
         | 
| 80 | 
            +
                  X-Xss-Protection:
         | 
| 81 | 
            +
                  - 1; mode=block
         | 
| 82 | 
            +
                  X-Content-Type-Options:
         | 
| 83 | 
            +
                  - nosniff
         | 
| 84 | 
            +
                  Cache-Control:
         | 
| 85 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 86 | 
            +
                  - post-check=0, pre-check=0
         | 
| 87 | 
            +
                  Pragma:
         | 
| 88 | 
            +
                  - no-cache
         | 
| 89 | 
            +
                  X-Rate-Limit-Limit:
         | 
| 90 | 
            +
                  - '100'
         | 
| 91 | 
            +
                  X-Rate-Limit-Remaining:
         | 
| 92 | 
            +
                  - '99'
         | 
| 93 | 
            +
                  X-Rate-Limit-Reset:
         | 
| 94 | 
            +
                  - '2'
         | 
| 95 | 
            +
                  Content-Type:
         | 
| 96 | 
            +
                  - application/json;charset=UTF-8
         | 
| 97 | 
            +
                  Content-Length:
         | 
| 98 | 
            +
                  - '429'
         | 
| 99 | 
            +
                  Date:
         | 
| 100 | 
            +
                  - Wed, 27 Sep 2017 18:21:56 GMT
         | 
| 101 | 
            +
                  Server:
         | 
| 102 | 
            +
                  - tripletex.no
         | 
| 103 | 
            +
                body:
         | 
| 104 | 
            +
                  encoding: UTF-8
         | 
| 105 | 
            +
                  string: |-
         | 
| 106 | 
            +
                    {
         | 
| 107 | 
            +
                      "value" : {
         | 
| 108 | 
            +
                        "id" : 12993,
         | 
| 109 | 
            +
                        "version" : 0,
         | 
| 110 | 
            +
                        "url" : "tripletex.no/v2/token/session/12993",
         | 
| 111 | 
            +
                        "consumerToken" : {
         | 
| 112 | 
            +
                          "id" : 3135,
         | 
| 113 | 
            +
                          "url" : "tripletex.no/v2/token/consumer/3135"
         | 
| 114 | 
            +
                        },
         | 
| 115 | 
            +
                        "employeeToken" : {
         | 
| 116 | 
            +
                          "id" : 603,
         | 
| 117 | 
            +
                          "url" : "tripletex.no/v2/token/employee/603"
         | 
| 118 | 
            +
                        },
         | 
| 119 | 
            +
                        "expirationDate" : "<%= (Time.now.utc.to_date + 1).to_s %>",
         | 
| 120 | 
            +
                        "token" : "72a4e9a3-2dc4-4b36-aa69-329e8aaba7bf",
         | 
| 121 | 
            +
                        "encryptionKey" : null
         | 
| 122 | 
            +
                      }
         | 
| 123 | 
            +
                    }
         | 
| 124 | 
            +
                http_version: 
         | 
| 125 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:21:57 GMT
         | 
| 126 | 
            +
            - request:
         | 
| 127 | 
            +
                method: get
         | 
| 128 | 
            +
                uri: https://tripletex.no/v2/token/session/%3EwhoAmI
         | 
| 129 | 
            +
                body:
         | 
| 130 | 
            +
                  encoding: US-ASCII
         | 
| 131 | 
            +
                  string: ''
         | 
| 132 | 
            +
                headers:
         | 
| 133 | 
            +
                  Content-Type:
         | 
| 134 | 
            +
                  - application/json
         | 
| 135 | 
            +
                  Authorization:
         | 
| 136 | 
            +
                  - Basic MDo3MmE0ZTlhMy0yZGM0LTRiMzYtYWE2OS0zMjllOGFhYmE3YmY=
         | 
| 137 | 
            +
                  User-Agent:
         | 
| 138 | 
            +
                  - Faraday v0.13.1
         | 
| 139 | 
            +
                  Accept-Encoding:
         | 
| 140 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 141 | 
            +
                  Accept:
         | 
| 142 | 
            +
                  - "*/*"
         | 
| 143 | 
            +
              response:
         | 
| 144 | 
            +
                status:
         | 
| 145 | 
            +
                  code: 200
         | 
| 146 | 
            +
                  message: OK
         | 
| 147 | 
            +
                headers:
         | 
| 148 | 
            +
                  X-Frame-Options:
         | 
| 149 | 
            +
                  - SAMEORIGIN
         | 
| 150 | 
            +
                  Frame-Options:
         | 
| 151 | 
            +
                  - SAMEORIGIN
         | 
| 152 | 
            +
                  Strict-Transport-Security:
         | 
| 153 | 
            +
                  - max-age=31536000
         | 
| 154 | 
            +
                  X-Xss-Protection:
         | 
| 155 | 
            +
                  - 1; mode=block
         | 
| 156 | 
            +
                  X-Content-Type-Options:
         | 
| 157 | 
            +
                  - nosniff
         | 
| 158 | 
            +
                  Cache-Control:
         | 
| 159 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 160 | 
            +
                  - post-check=0, pre-check=0
         | 
| 161 | 
            +
                  Pragma:
         | 
| 162 | 
            +
                  - no-cache
         | 
| 163 | 
            +
                  Set-Cookie:
         | 
| 164 | 
            +
                  - JSESSIONID=170C4C922C35B9E9B3679E714FF84CBE; Domain=tripletex.no; Path=/;
         | 
| 165 | 
            +
                    Secure; HttpOnly
         | 
| 166 | 
            +
                  X-Rate-Limit-Limit:
         | 
| 167 | 
            +
                  - '100'
         | 
| 168 | 
            +
                  X-Rate-Limit-Remaining:
         | 
| 169 | 
            +
                  - '99'
         | 
| 170 | 
            +
                  X-Rate-Limit-Reset:
         | 
| 171 | 
            +
                  - '2'
         | 
| 172 | 
            +
                  Content-Type:
         | 
| 173 | 
            +
                  - application/json;charset=UTF-8
         | 
| 174 | 
            +
                  Content-Length:
         | 
| 175 | 
            +
                  - '75'
         | 
| 176 | 
            +
                  Date:
         | 
| 177 | 
            +
                  - Wed, 27 Sep 2017 18:21:56 GMT
         | 
| 178 | 
            +
                  Server:
         | 
| 179 | 
            +
                  - tripletex.no
         | 
| 180 | 
            +
                body:
         | 
| 181 | 
            +
                  encoding: UTF-8
         | 
| 182 | 
            +
                  string: |-
         | 
| 183 | 
            +
                    {
         | 
| 184 | 
            +
                      "value" : {
         | 
| 185 | 
            +
                        "employeeId" : 1133333,
         | 
| 186 | 
            +
                        "companyId" : 3795625
         | 
| 187 | 
            +
                      }
         | 
| 188 | 
            +
                    }
         | 
| 189 | 
            +
                http_version: 
         | 
| 190 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:21:57 GMT
         | 
| 191 | 
            +
            - request:
         | 
| 192 | 
            +
                method: delete
         | 
| 193 | 
            +
                uri: https://tripletex.no/v2/token/session/72a4e9a3-2dc4-4b36-aa69-329e8aaba7bf
         | 
| 194 | 
            +
                body:
         | 
| 195 | 
            +
                  encoding: US-ASCII
         | 
| 196 | 
            +
                  string: ''
         | 
| 197 | 
            +
                headers:
         | 
| 198 | 
            +
                  Content-Type:
         | 
| 199 | 
            +
                  - application/json
         | 
| 200 | 
            +
                  Authorization:
         | 
| 201 | 
            +
                  - Basic MDo3MmE0ZTlhMy0yZGM0LTRiMzYtYWE2OS0zMjllOGFhYmE3YmY=
         | 
| 202 | 
            +
                  User-Agent:
         | 
| 203 | 
            +
                  - Faraday v0.13.1
         | 
| 204 | 
            +
                  Accept-Encoding:
         | 
| 205 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 206 | 
            +
                  Accept:
         | 
| 207 | 
            +
                  - "*/*"
         | 
| 208 | 
            +
              response:
         | 
| 209 | 
            +
                status:
         | 
| 210 | 
            +
                  code: 204
         | 
| 211 | 
            +
                  message: No Content
         | 
| 212 | 
            +
                headers:
         | 
| 213 | 
            +
                  X-Frame-Options:
         | 
| 214 | 
            +
                  - SAMEORIGIN
         | 
| 215 | 
            +
                  Frame-Options:
         | 
| 216 | 
            +
                  - SAMEORIGIN
         | 
| 217 | 
            +
                  Strict-Transport-Security:
         | 
| 218 | 
            +
                  - max-age=31536000
         | 
| 219 | 
            +
                  X-Xss-Protection:
         | 
| 220 | 
            +
                  - 1; mode=block
         | 
| 221 | 
            +
                  X-Content-Type-Options:
         | 
| 222 | 
            +
                  - nosniff
         | 
| 223 | 
            +
                  Cache-Control:
         | 
| 224 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 225 | 
            +
                  - post-check=0, pre-check=0
         | 
| 226 | 
            +
                  Pragma:
         | 
| 227 | 
            +
                  - no-cache
         | 
| 228 | 
            +
                  Set-Cookie:
         | 
| 229 | 
            +
                  - JSESSIONID=65197B080FB626C1E96EB0A5B95103C5; Domain=tripletex.no; Path=/;
         | 
| 230 | 
            +
                    Secure; HttpOnly
         | 
| 231 | 
            +
                  X-Rate-Limit-Limit:
         | 
| 232 | 
            +
                  - '100'
         | 
| 233 | 
            +
                  X-Rate-Limit-Remaining:
         | 
| 234 | 
            +
                  - '98'
         | 
| 235 | 
            +
                  X-Rate-Limit-Reset:
         | 
| 236 | 
            +
                  - '2'
         | 
| 237 | 
            +
                  Date:
         | 
| 238 | 
            +
                  - Wed, 27 Sep 2017 18:21:57 GMT
         | 
| 239 | 
            +
                  Server:
         | 
| 240 | 
            +
                  - tripletex.no
         | 
| 241 | 
            +
                body:
         | 
| 242 | 
            +
                  encoding: UTF-8
         | 
| 243 | 
            +
                  string: ''
         | 
| 244 | 
            +
                http_version: 
         | 
| 245 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:21:58 GMT
         | 
| 246 | 
            +
            - request:
         | 
| 247 | 
            +
                method: get
         | 
| 248 | 
            +
                uri: https://tripletex.no/v2/token/session/%3EwhoAmI
         | 
| 249 | 
            +
                body:
         | 
| 250 | 
            +
                  encoding: US-ASCII
         | 
| 251 | 
            +
                  string: ''
         | 
| 252 | 
            +
                headers:
         | 
| 253 | 
            +
                  Content-Type:
         | 
| 254 | 
            +
                  - application/json
         | 
| 255 | 
            +
                  User-Agent:
         | 
| 256 | 
            +
                  - Faraday v0.13.1
         | 
| 257 | 
            +
                  Accept-Encoding:
         | 
| 258 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 259 | 
            +
                  Accept:
         | 
| 260 | 
            +
                  - "*/*"
         | 
| 261 | 
            +
              response:
         | 
| 262 | 
            +
                status:
         | 
| 263 | 
            +
                  code: 401
         | 
| 264 | 
            +
                  message: Unauthorized
         | 
| 265 | 
            +
                headers:
         | 
| 266 | 
            +
                  X-Frame-Options:
         | 
| 267 | 
            +
                  - SAMEORIGIN
         | 
| 268 | 
            +
                  Frame-Options:
         | 
| 269 | 
            +
                  - SAMEORIGIN
         | 
| 270 | 
            +
                  Strict-Transport-Security:
         | 
| 271 | 
            +
                  - max-age=31536000
         | 
| 272 | 
            +
                  X-Xss-Protection:
         | 
| 273 | 
            +
                  - 1; mode=block
         | 
| 274 | 
            +
                  X-Content-Type-Options:
         | 
| 275 | 
            +
                  - nosniff
         | 
| 276 | 
            +
                  Cache-Control:
         | 
| 277 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 278 | 
            +
                  - post-check=0, pre-check=0
         | 
| 279 | 
            +
                  Pragma:
         | 
| 280 | 
            +
                  - no-cache
         | 
| 281 | 
            +
                  Content-Type:
         | 
| 282 | 
            +
                  - application/json;charset=ISO-8859-1
         | 
| 283 | 
            +
                  Content-Length:
         | 
| 284 | 
            +
                  - '216'
         | 
| 285 | 
            +
                  Date:
         | 
| 286 | 
            +
                  - Wed, 27 Sep 2017 18:21:57 GMT
         | 
| 287 | 
            +
                  Server:
         | 
| 288 | 
            +
                  - tripletex.no
         | 
| 289 | 
            +
                body:
         | 
| 290 | 
            +
                  encoding: UTF-8
         | 
| 291 | 
            +
                  string: '{"status":401,"code":3000,"message":"Unauthorized","link":null,"developerMessage":"Could
         | 
| 292 | 
            +
                    not log in. The Authorization header is missing.","validationMessages":null,"requestId":"47df05fd-fef1-410b-a132-efb815fa9c9d"}'
         | 
| 293 | 
            +
                http_version: 
         | 
| 294 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:21:58 GMT
         | 
| 295 | 
            +
            recorded_with: VCR 3.0.3
         | 
| @@ -0,0 +1,68 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: get
         | 
| 5 | 
            +
                uri: https://tripletex.no/v2/token/session/%3EwhoAmI
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: US-ASCII
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  Authorization:
         | 
| 13 | 
            +
                  - Basic MDoxYzk1MGE2Zi1mMjYyLTQyOTQtOTgzNS04MGMyODFmZDJiZTg=
         | 
| 14 | 
            +
                  User-Agent:
         | 
| 15 | 
            +
                  - Faraday v0.13.1
         | 
| 16 | 
            +
                  Accept-Encoding:
         | 
| 17 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 18 | 
            +
                  Accept:
         | 
| 19 | 
            +
                  - "*/*"
         | 
| 20 | 
            +
              response:
         | 
| 21 | 
            +
                status:
         | 
| 22 | 
            +
                  code: 200
         | 
| 23 | 
            +
                  message: OK
         | 
| 24 | 
            +
                headers:
         | 
| 25 | 
            +
                  X-Frame-Options:
         | 
| 26 | 
            +
                  - SAMEORIGIN
         | 
| 27 | 
            +
                  Frame-Options:
         | 
| 28 | 
            +
                  - SAMEORIGIN
         | 
| 29 | 
            +
                  Strict-Transport-Security:
         | 
| 30 | 
            +
                  - max-age=31536000
         | 
| 31 | 
            +
                  X-Xss-Protection:
         | 
| 32 | 
            +
                  - 1; mode=block
         | 
| 33 | 
            +
                  X-Content-Type-Options:
         | 
| 34 | 
            +
                  - nosniff
         | 
| 35 | 
            +
                  Cache-Control:
         | 
| 36 | 
            +
                  - no-store, no-cache, must-revalidate, max-age=0
         | 
| 37 | 
            +
                  - post-check=0, pre-check=0
         | 
| 38 | 
            +
                  Pragma:
         | 
| 39 | 
            +
                  - no-cache
         | 
| 40 | 
            +
                  Set-Cookie:
         | 
| 41 | 
            +
                  - JSESSIONID=1E2BACEF8C18559BFACB0B14388588F3; Domain=tripletex.no; Path=/;
         | 
| 42 | 
            +
                    Secure; HttpOnly
         | 
| 43 | 
            +
                  X-Rate-Limit-Limit:
         | 
| 44 | 
            +
                  - '100'
         | 
| 45 | 
            +
                  X-Rate-Limit-Remaining:
         | 
| 46 | 
            +
                  - '99'
         | 
| 47 | 
            +
                  X-Rate-Limit-Reset:
         | 
| 48 | 
            +
                  - '3'
         | 
| 49 | 
            +
                  Content-Type:
         | 
| 50 | 
            +
                  - application/json;charset=UTF-8
         | 
| 51 | 
            +
                  Content-Length:
         | 
| 52 | 
            +
                  - '75'
         | 
| 53 | 
            +
                  Date:
         | 
| 54 | 
            +
                  - Wed, 27 Sep 2017 18:12:56 GMT
         | 
| 55 | 
            +
                  Server:
         | 
| 56 | 
            +
                  - tripletex.no
         | 
| 57 | 
            +
                body:
         | 
| 58 | 
            +
                  encoding: UTF-8
         | 
| 59 | 
            +
                  string: |-
         | 
| 60 | 
            +
                    {
         | 
| 61 | 
            +
                      "value" : {
         | 
| 62 | 
            +
                        "employeeId" : 1133333,
         | 
| 63 | 
            +
                        "companyId" : 3795625
         | 
| 64 | 
            +
                      }
         | 
| 65 | 
            +
                    }
         | 
| 66 | 
            +
                http_version: 
         | 
| 67 | 
            +
              recorded_at: Wed, 27 Sep 2017 18:12:56 GMT
         | 
| 68 | 
            +
            recorded_with: VCR 3.0.3
         | 
    
        data/spec/web_helper.rb
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'webmock/rspec'
         | 
| 3 | 
            +
            require 'vcr'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            VCR.configure do |config|
         | 
| 6 | 
            +
              config.cassette_library_dir = 'spec/vcr_cassettes'
         | 
| 7 | 
            +
              config.hook_into :webmock
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            RSpec.configure do |config|
         | 
| 11 | 
            +
              config.around(:each) do |example|
         | 
| 12 | 
            +
                if cassette = example.metadata[:vcr]
         | 
| 13 | 
            +
                  VCR.use_cassette(cassette, erb: true) do
         | 
| 14 | 
            +
                    example.run
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                else
         | 
| 17 | 
            +
                  example.run
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         |