I am all authenticated, and send this request to https://api.ecobee.com/1/thermostat:
{"selection":{"selectionType":"registered","selectonMatch":""},"functions":[{"type":"setHold","params":{"holdType":"indefinite","heatHoldTemp":716,"coolHoldTemp":716}}]}
I get as answer:
{
"page": {
"page": 1,
"totalPages": 1,
"pageSize": 1,
"total": 1
},
"thermostatList": [
{
"identifier": "--hidden--",
"name": "Thermostat",
"thermostatRev": "230212020022",
"isRegistered": true,
"modelNumber": "nikeSmart",
"brand": "ecobee",
"features": "Home,HomeKit",
"lastModified": "2023-02-12 02:00:22",
"thermostatTime": "2023-02-13 11:36:30",
"utcTime": "2023-02-13 16:36:30"
}
],
"status": {
"code": 0,
"message": ""
}
}
But there is no Events in my thermostat:
"events": [
{
"type": "template",
"name": "_Default_",
"running": false,
"startDate": "2037-01-01",
"startTime": "01:01:01",
"endDate": "2037-01-01",
"endTime": "02:01:01",
"isOccupied": false,
"isCoolOff": false,
"isHeatOff": false,
"coolHoldTemp": 788,
"heatHoldTemp": 644,
"fan": "auto",
"vent": "off",
"ventilatorMinOnTime": 5,
"isOptional": true,
"isTemperatureRelative": false,
"coolRelativeTemp": 40,
"heatRelativeTemp": 40,
"isTemperatureAbsolute": true,
"dutyCyclePercentage": 255,
"fanMinOnTime": 20,
"occupiedSensorActive": false,
"unoccupiedSensorActive": false,
"drRampUpTemp": 0,
"drRampUpTime": 3600,
"linkRef": "",
"holdClimateRef": "",
"fanSpeed": "low"
}
]
I am expecting, following the guide, that a Hold event is present. I do not see either a change on my thermostat UI.
Found it.
I was using HTTP GET instead of POST.
There was some typos in my JSON (selecton)
I was appending payload to URL, not as POST payload.
Related
I'm trying to make a data table which consists of some calculations
******************************************************
** Bidder * Request * CPM * Revenue * Response Time **
******************************************************
I've created an index which holds all the data, so my data is stored in following format:
{
"data": {
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 78,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "nits_media_bid_won",
"_type": "nits_media_data_collection",
"_id": "MIyt6m8BWa2IbVphmPUh",
"_score": 1,
"_source": {
"bidderCode": "appnexus",
"width": 300,
"height": 600,
"statusMessage": "Bid available",
"adId": "43d59b34fd61b5",
"requestId": "2c6d19dcc536c3",
"mediaType": "banner",
"source": "client",
"cpm": 0.5,
"creativeId": 98493581,
"currency": "USD",
"netRevenue": true,
"ttl": 300,
"adUnitCode": "/19968336/header-bid-tag-0",
"appnexus": {
"buyerMemberId": 9325
},
"meta": {
"advertiserId": 2529885
},
"originalCpm": 0.5,
"originalCurrency": "USD",
"auctionId": "a628c0c0-bd4d-4f2a-9011-82fab780910e",
"responseTimestamp": 1580190231422,
"requestTimestamp": 1580190231022,
"bidder": "appnexus",
"timeToRespond": 400,
"pbLg": "0.50",
"pbMg": "0.50",
"pbHg": "0.50",
"pbAg": "0.50",
"pbDg": "0.50",
"pbCg": null,
"size": "300x600",
"adserverTargeting": {
"hb_bidder": "appnexus",
"hb_adid": "43d59b34fd61b5",
"hb_pb": "0.50",
"hb_size": "300x600",
"hb_source": "client",
"hb_format": "banner"
},
"status": "rendered",
"params": [
{
"placementId": 13144370
}
],
"nits_account": "asjdfagsd2384vasgd19",
"nits_url": "http://nitsmedia.local/run-ad",
"session_id": "YTGpETKSk2nHwLRB6GbP",
"timestamp": "2020-01-28T05:43:51.702Z",
"geo_data": {
"continent": "North America",
"address_format": "{{recipient}}\n{{street}}\n{{city}} {{region_short}} {{postalcode}}\n{{country}}",
"alpha2": "US",
"alpha3": "USA",
"country_code": "1",
"international_prefix": "011",
"ioc": "USA",
"gec": "US",
"name": "United States of America",
"national_destination_code_lengths": [
3
],
"national_number_lengths": [
10
],
"national_prefix": "1",
"number": "840",
"region": "Americas",
"subregion": "Northern America",
"world_region": "AMER",
"un_locode": "US",
"nationality": "American",
"postal_code": true,
"unofficial_names": [
"United States",
"Vereinigte Staaten von Amerika",
"États-Unis",
"Estados Unidos",
"アメリカ合衆国",
"Verenigde Staten"
],
"languages_official": [
"en"
],
"languages_spoken": [
"en"
],
"geo": {
"latitude": 37.09024000000000143018041853792965412139892578125,
"latitude_dec": "39.44325637817383",
"longitude": -95.7128909999999990532160154543817043304443359375,
"longitude_dec": "-98.95733642578125",
"max_latitude": 71.5388001000000031126546673476696014404296875,
"max_longitude": -66.8854170000000038953658076934516429901123046875,
"min_latitude": 18.77629999999999910187398199923336505889892578125,
"min_longitude": 170.595699999999993679011822678148746490478515625,
"bounds": {
"northeast": {
"lat": 71.5388001000000031126546673476696014404296875,
"lng": -66.8854170000000038953658076934516429901123046875
},
"southwest": {
"lat": 18.77629999999999910187398199923336505889892578125,
"lng": 170.595699999999993679011822678148746490478515625
}
}
},
"currency_code": "USD",
"start_of_week": "sunday"
}
}
},
//Remaining data set....
]
},
}
}
So as per my data set I want to fetch all unique bidderCode (which will be represented as Bidder in the table) and make the data with calculation respective to it. For example
Request - This will be total number of docs count in aggregation
CPM - CPM will be sum of all CPM divided by 1000
Revenue - Total CPM multiplied by 1000
Response time - Average of (responseTimestamp - requestTimestamp)
How can I achieve this, I'm bit confused with it. I tried building the blocks by:
return $this->elasticsearch->search([
'index' => 'nits_media_bid_won',
'body' => [
'query' => $query,
'aggs' => [
'unique_bidders' => [
'terms' => ['field' => 'bidderCode.keyword']
],
'aggs' => [
'sum' => [
'cpm' => [
'field' => 'cpm',
'script' => '_value / 1000'
]
]
],
]
]
]);
But it is showing me error:
{
"error":{
"root_cause":[
{
"type":"x_content_parse_exception",
"reason":"[1:112] [sum] unknown field [cpm], parser not found"
}
],
"type":"x_content_parse_exception",
"reason":"[1:112] [sum] unknown field [cpm], parser not found"
},
"status":400
}
I'm new to this help me out in it. Thanks.
ElasticSearch isn't wrong -- you've swapped the aggregation name with its type. It cannot parse the agg type cpm.
Here's the corrected query:
GET nits_media_bid_won/_search
{
"size": 0,
"aggs": {
"unique_bidders": {
"terms": {
"field": "bidderCode.keyword",
"size": 10
},
"aggs": {
"cpm": { <----------
"sum": { <----------
"field": "cpm",
"script": "_value / 1000"
}
}
}
}
}
}
I need to integrate the Klarna Checkout module into magento 2.1.2. I am using the version of the "klarna/m2-checkout module": 4.2.2.
When choosing a delivery method, I always get an error in the pop-up window:
Sorry, the delivery option you chose cannot be processed. Please select another delivery option.
When i choose shipping method, i get this responce:
{
"shared": {
"customer": {
"type": "person"
},
"user_preferences": {
"remember_me": true
},
"language": "en",
"locale": "en-US",
"customer_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJz",
"country": "swe",
"completed": true,
"fields_with_obfuscation": {
"email": "melosicuva#royalhost.info",
"given_name": "Testperson-se",
"family_name": "Approved",
"street_address": "Stårgatan 1",
"postal_code": "123 45",
"city": "Ankeborg",
"country": "SE",
"phone": "076-526 00 00",
"date_of_birth": "1941-03-21",
"national_identification_number": "19410321-9202"
},
"reference": "2f9a445a57a49215175178099002fc7165ee"
},
"shipping_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJzZXNzaW9uX"
},
"currency": "SEK",
"obfuscated_fields": []
},
"cart": {
"total_tax_amount": 30000,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"total_shipping_amount_excluding_tax": 0,
"total_surcharge_amount_excluding_tax": 0,
"total_discount_amount_excluding_tax": 0,
"total_shipping_amount_including_tax": 0,
"total_surcharge_amount_including_tax": 0,
"total_discount_amount_including_tax": 0,
"subtotal": 120000,
"total_store_credit": 0,
"items": [{
"type": "physical",
"reference": "1201018390010",
"name": "Armour Bib Shorts",
"quantity": 1,
"unit_price": 150000,
"total_tax_amount": 30000,
"tax_rate": 2500,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"product_url": "https://local.com/armour-bib-shorts-black.html?___store%5B_data%5D%5Bstore_id%5D=2&___store%5B_data%5D%5Bcode%5D=se&___store%5B_data%5D%5Bwebsite_id%5D=2&___store%5B_data%5D%5Bgroup_id%5D=2&___store%5B_data%5D%5Bname%5D=Sweden+Store&___store%5B_data%5D%5Bsort_order%5D=30&___store%5B_data%5D%5Bis_active%5D=1&___store%5B_data%5D%5Balias%5D=Sweden&___store%5B_data%5D%5Bavailable_currency_codes%5D%5B0%5D=SEK",
"image_url": "https://local.com//media/catalog/product/a/r/armour-bib-shorts-aw18-01.jpg"
}]
},
"errors": {
"generic": ["shipping_service_failed"]
},
"options": {
"allow_separate_shipping_address": false,
"date_of_birth_mandatory": false,
"title_mandatory": false,
"national_identification_number_mandatory": false,
"phone_mandatory": true,
"allowed_customer_types": ["person"],
"payment_selector_on_load": false
},
"preview_payment_methods": [{
"id": "-1",
"type": "invoice",
"locked": false,
"selected": false,
"data": {
"days": 14
}
}, {
"id": "-1",
"type": "direct_debit",
"locked": false,
"selected": false
}, {
"id": "-1",
"type": "credit_card",
"locked": false,
"selected": false,
"data": {
"available_cards": ["VISA", "MASTER"],
"allow_saved_card": false,
"do_save_card": false,
"collect_consent": false,
"consent_given": false
}
}],
"allowed_billing_countries": ["swe"],
"status": {
"prescreened": false
},
"analytics_user_id": "ELmpDn1f600JYxHtagC7FcsOdAXe9-2iwWhIzHSfmhM=",
"merchant": {
"hashed_id": "a9c814c7a780d46a7fb2403e452829b3",
"name": "Your business name"
},
"merchant_urls": {
"checkout": "https://local.com/checkout/klarna",
"confirmation": "https://checkout-eu.playground.klarna.com/yaco/orders/ffc4101d-00cb-5e63-81fc-0f0c15baeac3/redirect?auth_token=0el7mltb89prfz2fz2mw",
"terms": "https://local.com/terms",
"confirmation_page": "https://local.com/checkout/klarna/confirmation/id/ffc4101d-00cb-5e63-81fc-0f0c15baeac3"
}
}
Here I do not like the block:
"errors": {
"generic": ["shipping_service_failed"]
}
Does anyone know how to fix it?
Delivery error :
This error occurs when you set address_update callback and and it's not handled in the right way. This callback should be set if you need to update order's addresses, and should not take more than 10 sec.
Here's an example: https://developers.klarna.com/api/#checkout-api-callbacks-address-update
And some best practices: https://developers.klarna.com/documentation/klarna-checkout/best-practices/#address-updated
If you run Klarna Checkout on localhost, then you should make the localhost-based application reachable from Klarna via the HTTP protocol (e.g., for the address_update callback).
You can do it via services like Ngrok.
In case of this error it's good to know that:
Klarna Checkout is calling callbacks regarding the shipping on checkout page:
address_update
shipping_option_update
If Klarna doesn't receive the answer from callback request in 10s it will end the connection and eventually you will see the error message. You can find access status logs in your http server, for example access status 499 in nginx. On the other hand in Klarna Merchant Portal you will see logs with status "???".
The callback request may be not accessible or not accessible in time below 10s:
if you work on localhost configure tunnel to expose your local environment to be visible by Klarna. For example with ngrok.
make sure that magento cache is enabled.
disable xdebug (unless it's version >=3)
check internet connection quality
check php.ini and http server performance related settings
If error still occurs you can debug the callback api to find the bottleneck. For example you can use logs in Klarna Merchant Portal to create a postman request to the callback api.
I use create event api to create an event object with "onlineMeetingUrl: https://meet.lync.com/example/joyce/NLSD7Y62" but the response of "onlineMeetingUrl" is null.
Is it a bug or is there any way to create a new event with 'onlineMeetingUrl'?
Here are my test steps.
Step 1. POST /me/events
{
"#odata.etag": "W/\"BfXylo4WykyAenTZICXL5AAApUQ11g==\"",
"id": "AAMkADVmMzE2MjY0LTZkOGYtNGI4MS1iNWMxLTljYzg3MWY5MWQxMQBGAAAAAABZMfR36TVMQ6yunaqZPvVRBwAF9fKWjhbKTIB6dNkgJcvkAAAAAAENAAAF9fKWjhbKTIB6dNkgJcvkAAClFy2jAAA=",
"createdDateTime": "2018-03-07T02:31:20.6459109Z",
"lastModifiedDateTime": "2018-03-07T02:31:24.2554747Z",
"changeKey": "BfXylo4WykyAenTZICXL5AAApUQ11g==",
"categories": [],
"originalStartTimeZone": "Taipei Standard Time",
"originalEndTimeZone": "Taipei Standard Time",
"iCalUId": "040000008200E00074C5B7101A82E00800000000E5DACD60BCB5D301000000000000000010000000A65419D96CF4C347B8B3B5A340753291",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "Sky Meeting",
"bodyPreview": "Join online meeting",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkADVmMzE2MjY0LTZkOGYtNGI4MS1iNWMxLTljYzg3MWY5MWQxMQBGAAAAAABZMfR36TVMQ6yunaqZPvVRBwAF9fKWjhbKTIB6dNkgJcvkAAAAAAENAAAF9fKWjhbKTIB6dNkgJcvkAAClFy2jAAA%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": "https://meet.lync.com/example/joyce/NLSD7Y62",
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "Join online meeting"
},
"start": {
"dateTime": "2018-03-08T00:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-03-08T00:30:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "Online meeting"
},
"recurrence": null,
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Joyce",
"address": "joyce#example.com"
}
}
}
Step 2. The onlineMeetingUrl in the response event object is null.
{
...
"onlineMeetingUrl": null,
...
}
The onlineMeetingUrl property is not writable. We will update the documentation to reflect this.
Add these params in the request body
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
onlineMeetingUrl is null in response even while passing "isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
I think there's a file where settings of every addon installed are stored. Where can I find it?
I need the name of the extensions, the version, the state(enabled,disabled,uninstalled) and the extensions ID.
All the information you seek is in $profD/extensions.json
E. g.
{
"schemaVersion": 17,
"addons": [
{
"id": "addon#example.org",
"syncGUID": "-3yoR7F-ml47",
"location": "app-profile",
"version": "0.0.1.34",
"type": "extension",
"internalName": null,
"updateURL": null,
"updateKey": null,
"optionsURL": null,
"optionsType": null,
"aboutURL": null,
"icons": {
},
"iconURL": null,
"icon64URL": null,
"defaultLocale": {
"name": "My addon",
"description": "Addon description",
"creator": "me",
"homepageURL": null,
"developers": [
"me"
]
},
"visible": true,
"active": false,
"userDisabled": true,
"appDisabled": false,
"descriptor": "/home/user/.mozilla/firefox/w7svh0gr.ffnightly/extensions/addon#example.org",
"installDate": 1452014720000,
"updateDate": 1452015546000,
"applyBackgroundUpdates": 1,
"bootstrap": true,
"skinnable": false,
"size": 147533,
"sourceURI": "file:///home/user/addon.xpi",
"releaseNotesURI": null,
"softDisabled": false,
"foreignInstall": false,
"hasBinaryComponents": false,
"strictCompatibility": false,
"locales": [
],
"targetApplications": [
{
"id": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
"minVersion": "24.0a1",
"maxVersion": "37.0a1"
},
{
"id": "{aa3c5121-dab2-40e2-81ca-7ea25febc110}",
"minVersion": "25.0a1",
"maxVersion": "37.0a1"
}
],
"targetPlatforms": [
],
"multiprocessCompatible": false,
"signedState": 0
},
...
}
Don't need to find out the add-on files. Just use the AddonManager.jsm service:
const { Cu } = require("chrome");
let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm").AddonManager;
AddonManager.getAddonsByTypes(["extension"], function(addons) {
var addonData = [];
for (let i in addons) {
let cur = addons[i];
addonData.push({
id: cur.id.toString(),
name: cur.name,
version: cur.version,
active: cur.isActive
});
};
console.log(JSON.stringify(addonData, null, ' '));
});
For more detail on this just read these two docs.
I'm trying to parse a JSON string that I received from Twitter as a response via the RESTful API. I wanted to use the JSON gem, but I've run into an issue. Per the documentation, it appears that the JSON parser returns a Hash, which is what I want. However, when I actually perform the JSON.parse(twitter_result.body), it returns an Array. How can I get the JSON parser to return a Hash?
This is the parser I am using: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON.html#method-i-parse
"Pretty" JSON output example:
[
{
"created_at": "Sun Dec 08 13:00:52 +0000 2013",
"id": 409668902189137920,
"id_str": "409668902189137920",
"text": "\"All the people departed, and David went home to bless his household.\" 1 Chron. 16:43. Big meeting. Blessed home. Both.",
"source": "HootSuite",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 27500565,
"id_str": "27500565",
"name": "John Piper",
"screen_name": "JohnPiper",
"location": "Minneapolis, MN",
"description": "Founder-Teacher, Desiring God, Chancellor, BCS. Spreading a passion for the supremacy of God in all things for the joy of all peoples through Jesus Christ.",
"url": "http://t.co/qt1rUlRfdl",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/qt1rUlRfdl",
"expanded_url": "http://www.desiringgod.org",
"display_url": "desiringgod.org",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": [
]
}
},
"protected": false,
"followers_count": 564749,
"friends_count": 107,
[
{
"created_at": "Sun Dec 08 13:00:52 +0000 2013",
"id": 409668902189137920,
"id_str": "409668902189137920",
"text": "\"All the people departed, and David went home to bless his household.\" 1 Chron. 16:43. Big meeting. Blessed home. Both.",
"source": "HootSuite",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 27500565,
"id_str": "27500565",
"name": "John Piper",
"screen_name": "JohnPiper",
"location": "Minneapolis, MN",
"description": "Founder-Teacher, Desiring God, Chancellor, BCS. Spreading a passion for the supremacy of God in all things for the joy of all peoples through Jesus Christ.",
"url": "http://t.co/qt1rUlRfdl",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/qt1rUlRfdl",
"expanded_url": "http://www.desiringgod.org",
"display_url": "desiringgod.org",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": [
]
}
},
"protected": false,
"followers_count": 564749,
"friends_count": 107,
"listed_count": 9225,
"created_at": "Sun Mar 29 20:48:44 +0000 2009",
"favourites_count": 20,
"utc_offset": -21600,
"time_zone": "Central Time (US & Canada)",
"geo_enabled": true,
"verified": true,
"statuses_count": 7906,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "570000",
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/38963234/jp_twitter_1920x1200_b_2.jpg",
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/38963234/jp_twitter_1920x1200_b_2.jpg",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/1563845055/2010fallJPmug_normal.jpeg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1563845055/2010fallJPmug_normal.jpeg",
"profile_link_color": "5C0606",
"profile_sidebar_border_color": "000000",
"profile_sidebar_fill_color": "CCC2A3",
"profile_text_color": "000000",
"profile_use_background_image": true,
"default_profile": false,
"default_profile_image": false,
"following": true,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweet_count": 20,
"favorite_count": 31,
"entities": {
"hashtags": [
],
"symbols": [
],
"urls": [
],
"user_mentions": [
]
},
"favorited": false,
"retweeted": false,
"lang": "en"
}
] "listed_count": 9225,
"created_at": "Sun Mar 29 20:48:44 +0000 2009",
"favourites_count": 20,
"utc_offset": -21600,
"time_zone": "Central Time (US & Canada)",
"geo_enabled": true,
"verified": true,
"statuses_count": 7906,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "570000",
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/38963234/jp_twitter_1920x1200_b_2.jpg",
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/38963234/jp_twitter_1920x1200_b_2.jpg",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/1563845055/2010fallJPmug_normal.jpeg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1563845055/2010fallJPmug_normal.jpeg",
"profile_link_color": "5C0606",
"profile_sidebar_border_color": "000000",
"profile_sidebar_fill_color": "CCC2A3",
"profile_text_color": "000000",
"profile_use_background_image": true,
"default_profile": false,
"default_profile_image": false,
"following": true,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweet_count": 20,
"favorite_count": 31,
"entities": {
"hashtags": [
],
"symbols": [
],
"urls": [
],
"user_mentions": [
]
},
"favorited": false,
"retweeted": false,
"lang": "en"
}
]
JSON output returns an array with one element which is the Hash you're looking for.
Try this:
puts JSON.parse(twitter_result.body)[0]